I had the same problem. I fixed it as follows:
config/sequelize.js :
const sequelize = new Sequelize(database, user, password, { host, dialect: 'mysql', port, operatorsAliases, dialectOptions: { useUTC: true, // -->Add this line. for reading from database }, timezone: '+02:00', // -->Add this line. for writing to database pool: { max: 10, min: 0, idle: 10000, }, logging: console.log, // define: {}, })
momentJS (UTC):
const ACCEPT_FORMAT = 'YYYY-MM-DD hh:mm:ss' const { start_date, end_date } = req.params const start = moment.utc(start_date, ACCEPT_FORMAT) const end = moment.utc(end_date, ACCEPT_FORMAT) console.log(start) console.log(end)
Hope this helps someone .... :)
source share