2

I have been looking for this like since the last 2 - 3 hrs. Still I can't figure out how. I need to set it up as UTC+07 I see an option to specify it in the datasources.json

"mydb": { "host": "127.0.0.1", "port": 3306, "database": "mydb", "username": "root", "password": "root", "name": "mydb", "connector": "mysql", "timezone": "UTC+07:00" }

It seems to have no effect.

I have two fields (date_add and date_upd) in a table. Also I am using this package "loopback-ds-timestamp-mixin": "^3.2.2", to map these fields as a mixin

I have checked this link Strongloop How to config mysql timezone? and it's not working :)

node_modules/loopback-connector-mysql/lib/mysql.js

function MySQL(settings) {
    ......
    var options = {
        host: s.host || s.hostname || 'localhost',
        port: s.port || 3306,
        user: s.username || s.user,
        password: s.password,
        timezone: s.timezone,
        socketPath: s.socketPath,
        charset: s.collation.toUpperCase(), // Correct by docs despite seeming odd.
        supportBigNumbers: s.supportBigNumbers,
        connectionLimit: s.connectionLimit
      };
    .....
}

not quite sure if it's the correct script though :)

If it's not possible via the datasource configuration do you know how can we specify the timezone config for the application?

Community
  • 1
  • 1
ralixyle
  • 754
  • 1
  • 7
  • 18

0 Answers0