-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Set default timezone to 'Z' fixes #360 #361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Default timezone should keep being |
Regarding #360, if the test fails I have to check it. |
I understand wanting to remain backwards-compatible, but the current behaviour seems broken to me and this is an alpha release series. When it comes to Another workaround to consider is for the driver to use it's own Javascript constructor for dates (not datetimes or timestamps), creating objects that have no time part and ignore timezones completely, but that seems like a lot of incidental complexity to take on. On the other hand, defaulting to UTC prevents the issue, and users who are willing to manage the quirks in their application can still opt-in to using * which is why most people encourage storing only UTC in MySQL |
In I understand your point and agree to some degree. I first merged timezone support as defaulting to UTC but then changed as @felixge requested. |
The driver only does it if the timezone isn't local. https://github.com/felixge/node-mysql/blob/master/lib/protocol/packets/RowDataPacket.js#L42 |
You're saying that if the code always adds '00:00:00' to |
No, it doesn't work. The library must work with local, Z or any other timezone. If you find the solution for the problem (using any timezone) please tell me. |
If I had been able to find a solution this would be a different pull request 😉, but I'm fairly certain there is no driver-level workaround other than defining a new "DateWithoutTime" type (which I don't like for a number of reasons). The issue is that dates in MySQL are really just dates, and ignore times/timezones completely, whereas Javascript has no such concept natively. |
Give me a few days before pulling this. I'm going to check your problem. You said you happened to get this error when your timezone is negative using |
Yes. My local timezone is GMT-8 (PST).
|
IMO the default timezone should say |
+1 for defaulting to "Z". I always set all my machines in different environment/location to UTC to avoid timezone headache. |
My local timezone is EST, and I can confirm the issue as @grncdr describes still exists. +1 for defaulting default timezone to "Z", or at least updating the readme that the default "local" version is broken. [0:00:00 0 0/1 0.0% node test/integration/connection/test-type-casting.js] assert.js:102 [0:00:00 1 0/1 100.0% node test/integration/connection/test-type-casting.js] |
Closing this. Until the MySQL server starts defaulting the timezone to UTC, this module will not. |
No description provided.