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

Handle `TZInfo::AmbiguousTime` errors #31128

Merged
merged 1 commit into from Nov 15, 2017
Merged

Handle `TZInfo::AmbiguousTime` errors #31128

merged 1 commit into from Nov 15, 2017

Conversation

@pixeltrix
Copy link
Member

@pixeltrix pixeltrix commented Nov 11, 2017

Make ActiveSupport::TimeWithZone match Ruby's handling of ambiguous
times by choosing the later period, e.g.

Ruby:

ENV["TZ"] = "Europe/Moscow"
Time.local(2014, 10, 26, 1, 0, 0)   # => 2014-10-26 01:00:00 +0300

Before:

>> "2014-10-26 01:00:00".in_time_zone("Moscow")
TZInfo::AmbiguousTime: 26/10/2014 01:00 is an ambiguous local time.

After:

>> "2014-10-26 01:00:00".in_time_zone("Moscow")
=> Sun, 26 Oct 2014 01:00:00 MSK +03:00

Fixes #17395.

@pixeltrix pixeltrix force-pushed the handle-ambigious-times branch 2 times, most recently from 0ed25d8 to 041efa7 Nov 11, 2017
Make `ActiveSupport::TimeWithZone` match Ruby's handling of ambiguous
times by choosing the later period, e.g.

Ruby:
```
ENV["TZ"] = "Europe/Moscow"
Time.local(2014, 10, 26, 1, 0, 0)   # => 2014-10-26 01:00:00 +0300
```

Before:
```
>> "2014-10-26 01:00:00".in_time_zone("Moscow")
TZInfo::AmbiguousTime: 26/10/2014 01:00 is an ambiguous local time.
```

After:
```
>> "2014-10-26 01:00:00".in_time_zone("Moscow")
=> Sun, 26 Oct 2014 01:00:00 MSK +03:00
```

Fixes #17395.
@pixeltrix pixeltrix force-pushed the handle-ambigious-times branch from 041efa7 to 2eea645 Nov 15, 2017
@pixeltrix pixeltrix merged commit ebc6b17 into master Nov 15, 2017
3 checks passed
3 checks passed
codeclimate All good!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@pixeltrix pixeltrix deleted the handle-ambigious-times branch Nov 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants