-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Timezone conversion issue #543
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
Comments
There should be a |
Try calling conn.query('INSERT INTO datetime_bug SET created_at = ?', [ date ], function(err, result) {
// ...
}); |
@dresende that's exactly what I do, I call |
Essentially if you are going to use
The only possible solution that I think would do something to help would be to change the This is what should be within the if (val instanceof Date) {
val = SqlString.dateToString(val, timeZone || "local");
} |
Agree |
I adapted @chaoran's code from #538 to show an issue with manual escaping:
this will throw things like
AssertionError: "2013-07-12T07:39:55.000Z" == "2013-07-12T05:39:55.000Z"
unless you're living in UTC.To fix this, you need to call
escape(date, true, 'local')
. The issue is that the escaping converts to UTC but removes timezone information and mysql thinks that the date is a local date.Maybe the escape function should always convert dates to a CONVERT_TZ() call so there is never an issue no matter what the local and remote time zones.
The text was updated successfully, but these errors were encountered: