Commit Graph

9 Commits

Author SHA1 Message Date
Phil Ross e9425abe33
Update to TZInfo v2.0.0
Co-authored-by: Jared Beck <jared@jaredbeck.com>
Co-authored-by: Jonathan Hefner <jonathan@hefner.pro>
2020-03-28 20:42:43 +01:00
Dominik Sander 7d25b651fa Fix exception in AS::Timezone.all when any tzinfo data is missing
Before this change missing timezone data for any of the time zones
defined in `ActiveSupport::Timezone::MAPPING` caused a `comparison of
NilClass with ActiveSupport::TimeZone failed` exception.

Attempting to get a timezone by passing a number/duration to `[]` or
calling `all` directly will try to sort sort the values of `zones_map`.
Those values are initialized by the return value of `create(zonename)`
which returns `nil` if `TZInfo` is unable to find the timezone
information.

In our case the exception was triggered by an outdated tzdata package
which did not include information for the "recently" added time zones.

Before 078421bacb `zones_map` only
returned the information that have been loaded into `@lazy_zone_map`
which ignored time zones for which the data could not be loaded, this
change restores the previous behaviour.
2018-04-18 21:45:13 +02:00
Koichi ITO ac717d65a3 [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment` 2017-07-11 13:12:32 +09:00
Kir Shatrov 72950568dd Use frozen-string-literal in ActiveSupport 2017-07-09 15:08:29 +03:00
Matthew Draper 87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590, reversing
changes made to afb66a5a59.
2017-07-02 02:15:17 +09:30
Kir Shatrov cfade1ec7e Enforce frozen string in Rubocop 2017-07-01 02:11:03 +03:00
Xavier Noria a731125f12 applies new string literal convention in activesupport/test
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 18:10:53 +02:00
Andrew White c9c5788a52 Add compatibility for Ruby 2.4 `to_time` changes
In Ruby 2.4 the `to_time` method for both `DateTime` and `Time` will
preserve the timezone of the receiver when converting to an instance
of `Time`. Since Rails 5.0 will support Ruby 2.2, 2.3 and later we
need to introduce a compatibility layer so that apps that upgrade do
not break. New apps will have a config initializer file that defaults
to match the new Ruby 2.4 behavior going forward.

For information about the changes to Ruby see:
https://bugs.ruby-lang.org/issues/12189
https://bugs.ruby-lang.org/issues/12271

Fixes #24617.
2016-04-23 15:03:50 +01:00
Zuhao Wan 9c492885d1 Extract out with_env_tz helper method.
It’s used at so many places that extracting it out into a helper file
is worth doing.
2014-06-18 19:46:04 +08:00