sequelize timezone 配置

2019-07-22  本文已影响0人  whtsup

sequelize = new Sequelize(config.database, config.username, config.password, {
    host: config.host,
    dialect: 'mysql',
    pool: {
        max: 5,
        min: 0,
        idle: 30000
    },
    operatorsAliases: false, // 消除warning :https://github.com/sequelize/sequelize/issues/8417
    define: {
        freezeTableName: true,
        timestamps: true,
        updatedAt: false,
        createdAt: false
    },
    dialectOptions: {
        useUTC: false //for reading from database
    },
    timezone: '+08:00' //for writing to database
});

主要是配置
dialectOptions: {
useUTC: false //for reading from database
},
timezone: '+08:00' //for writing to database

上一篇下一篇

猜你喜欢

热点阅读