-
-
Notifications
You must be signed in to change notification settings - Fork 652
Description
Using mysql2 library on my machine running in Pacific time, the records, when deserialized from SQL response, seem to be applying local timezone offset but still keeping date object marked at UTC. This means the timezone offset is actually applied backwards:
Time in db record (SQL server set to UTC): 2016-02-01 21:39:46
Time returned by mysql2 (running on a machine in Pacific TZ): 2016-02-02T05:39:46.000Z (this is a UTC date in future, which is wrong)
Time returned by mysql2 when running on a machine with TZ set to UTC: 2016-02-01T21:39:46.000Z (this is correct time)
Expected result: I would expect toISOString() to return the same UTC date value regardless of client TZ, when reading the same record from the same server.
I believe this code is responsible for inserting SQL's UTC date into a JS object which is instantiated in local time:
Packet.prototype.readDateTime: ... return new Date(y, m-1, d, H, M, S, ms);