On my Sequelize setting, I'm using SQL Server and I have set up timezone and dialectOptions:
dialect: "mssql",
dialectOptions: {
useUTC: false,
dateStrings: true,
typeCast: true,
},
timezone: "Australia/Sydney"
I also have a code to convert the date format:
const DataTypes = require("sequelize/lib/data-types")
DataTypes.DATE.prototype._stringify = function _stringify(date, options) {
date = this._applyTimezone(date, options)
return date.format("YYYY-MM-DD HH:mm:ss.SSS")
}
The date record saving into database is the Sydney time. This is what I want. However, when retriving out the record, the output is always load as a UTC time even though actually it's a Sydney time. For example, what I saved in the database is 2021-10-20 00:56:59 and what I output from model is 2021-10-20T00:56:59.277Z. What I know the "Z" at the end stands for the Zero timezone, so it's a UTC time. How can I make the output display without "Z" so the system can know it's not a UTC time?