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

Issue with chrono and timezones #74

Open
julienw opened this issue Aug 5, 2016 · 1 comment
Open

Issue with chrono and timezones #74

julienw opened this issue Aug 5, 2016 · 1 comment

Comments

@julienw
Copy link
Collaborator

julienw commented Aug 5, 2016

I found Chrono has issues with timezones.

Here is an example:

chrono.parse('tomorrow', '2016-08-05T00:30+02:00')[0].start.date();
// => 2016-08-05T10:00:00.000Z
chrono.parse('tomorrow', '2016-08-05T01:59+02:00')[0].start.date()
// => 2016-08-05T10:00:00.000Z
chrono.parse('tomorrow', '2016-08-05T02:00+02:00')[0].start.date()
// => 2016-08-06T10:00:00.000Z

This is incorrect as "tomorrow" should always be on the 6th. (although that's actually debatable for our case).

There's more:

chrono.parse('tomorrow', '2016-08-05T23:00-07:00')[0].start.date()
// => 2016-08-07T10:00:00.000Z

Note that the result is always 12pm according to the current timezone (which is +02:00 here), this will make things difficult for testing :/ But even without looking at the timezone issue in the result, we see the result is 2 days later :/

In our code we don't specify a ref, that means chrono takes whatever the current local time is, including the timezone, which is IMO what we want.

I don't know how to fix this TBH. @gmarty, @samgiles any idea ?

@julienw
Copy link
Collaborator Author

julienw commented Aug 5, 2016

Filed wanasit/chrono#131 at chrono.

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

No branches or pull requests

1 participant