Skip to content

Issue with chrono and timezones  #74

@julienw

Description

@julienw

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions