Skip to content
  • Dominik Sander's avatar
    7d25b651
    Fix exception in AS::Timezone.all when any tzinfo data is missing · 7d25b651
    Dominik Sander authored
    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 078421ba `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.
    7d25b651
    Fix exception in AS::Timezone.all when any tzinfo data is missing
    Dominik Sander authored
    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 078421ba `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.
Loading