Swapnil Punekar
Swapnil Punekar

Reputation: 197

Timezone issue in Sequelize Node JS

I have built an application using Node JS and using sequelize ORM for connection with mysql

While configuring sequelize, I have provided timezone as "Europe/Oslo" but while running the application its giving warning related to mysql2 package that sequelize uses which is provided below

Ignoring invalid timezone passed to Connection: Europe/Oslo. This is currently a warning, but in future versions of MySQL2, an error will be thrown if you pass an invalid configuration option to a Connection

FYI: Cant use "+01:00" as timezone option as from 29th March daylight saving is started

Can anybody please help me with this.

Sequelize configurations are as follows:

enter image description here

Upvotes: 1

Views: 4861

Answers (1)

Adeel Nawaz
Adeel Nawaz

Reputation: 416

Remove collate option and pass timezone '+08:00' according to your timezone. i tested this setting working fine for me

const sequelize = new Sequelize(dbConfig.database, dbConfig.username, dbConfig.password, {
    "dialect": "mysql",
    "charset": "utf8mb4",
    "dialectOptions": {
      "useUTC": false
    },
    "logging": null,
    "timezone": "+00:00",
    "seederStorage": "sequelize",
    "operatorsAliases": false
});

Upvotes: 2

Related Questions