Skip to content
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

Add support for timezone connection option #996

Merged
merged 3 commits into from
Aug 12, 2019

Conversation

trevorr
Copy link
Contributor

@trevorr trevorr commented Aug 11, 2019

Support for the timezone connection option as specified by mysqljs/mysql:

timezone: The timezone configured on the MySQL server. This is used to type cast server date/time values to JavaScript Date object and vice versa. This can be 'local', 'Z', or an offset in the form +HH:MM or -HH:MM. (Default: 'local')

Inspired by #732 but with tests and against current master. Removes the need to run tests with process.env.TZ = 'UTC'. It doesn't set the session time_zone variable, but the user should do that if the server time zone is not the same as the requested time zone. However, since time_zone only applies to timestamp columns and date functions — and not stored datetime values — the client and server really need to agree on the time zone in advance anyway.

Fixes #15, #262, #642, #877, #888, and maybe others.

@sidorares sidorares merged commit 769c002 into sidorares:master Aug 12, 2019
@sidorares
Copy link
Owner

Great work @trevorr !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use timezone from connection options
2 participants