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

Timezone issues #131

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

Timezone issues #131

julienw opened this issue Aug 5, 2016 · 1 comment

Comments

@julienw
Copy link

julienw commented Aug 5, 2016

Hey !

I think 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.

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). But even without looking at the timezone issue in the result, we see the result is 2 days later :/

@wanasit
Copy link
Owner

wanasit commented Aug 11, 2016

Hi,

About the first three examples, guessing what "tomorrow" means in late night is difficult even for human. The current logic is, if it passes 1 AM, chrono will guess "tomorrow" means the tomorrow of the following morning, not the morning itself.

Probably 1 AM is too early and I should change this.

On the last example, that's not how you should use reference date. Chrono treats "2016-08-05T23:00-07:00" as a timestamp on your local. According to the timestamp, it's "Sat Aug 06 2016 15:00:00 GMT+0900 (JST)" on my computer. If I type "Tomorrow" on the time, it's August 7.

I'm not going to change this soon. As I'm not sure what kind of situation requires handling timezone on reference date, rather than the input text.

@wanasit wanasit closed this as completed Aug 11, 2016
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

2 participants