diff options
author | Andrew White <andrew.white@unboxed.co> | 2017-11-11 15:19:29 +0000 |
---|---|---|
committer | Andrew White <andrew.white@unboxed.co> | 2017-11-15 09:48:50 +0000 |
commit | 2eea6458a14d99b19dffe8673015cde0800f128a (patch) | |
tree | 2dc03c75ff5b0cf9b151c6d55ab3ba86326f0a3c /activesupport/CHANGELOG.md | |
parent | 23c41e4657a507c574e555339821f545c819e602 (diff) | |
download | rails-2eea6458a14d99b19dffe8673015cde0800f128a.tar.gz rails-2eea6458a14d99b19dffe8673015cde0800f128a.tar.bz2 rails-2eea6458a14d99b19dffe8673015cde0800f128a.zip |
Handle `TZInfo::AmbiguousTime` errors
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.
Diffstat (limited to 'activesupport/CHANGELOG.md')
-rw-r--r-- | activesupport/CHANGELOG.md | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index 4762c7d21d..904dab0e05 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -1,3 +1,30 @@ +* Handle `TZInfo::AmbiguousTime` errors + + 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. + + *Andrew White* + * Redis cache store. ``` |