Skip to content

Provide user friendly exceptions with deprecated time zones #469

@omus

Description

@omus

As discussed in #419 when a time zone becomes deprecated as "Europe/Amsterdam" was as of tzdata release 2022f they see the following error:

julia> using TimeZones

julia> tz"Europe/Amsterdam"
ERROR: LoadError: ArgumentError: The time zone "Europe/Amsterdam" is of class `TimeZones.Class(:LEGACY)` which is currently not allowed by the mask: `TimeZones.Class(:FIXED) | TimeZones.Class(:STANDARD)`
Stacktrace:
 [1] TimeZone(str::String, mask::TimeZones.Class)
   @ TimeZones ~/.julia/dev/TimeZones/src/types/timezone.jl:51
 [2] TimeZone(str::String)
   @ TimeZones ~/.julia/dev/TimeZones/src/types/timezone.jl:42
 [3] var"@tz_str"(__source__::LineNumberNode, __module__::Module, str::Any)
   @ TimeZones ~/.julia/dev/TimeZones/src/types/timezone.jl:72
in expression starting at REPL[17]:1

This error does not provide the user with the details of any possible replacement for the deprecated time zone. The backward region file contains this information and for 2022f it states that "Europe/Brussels" is the replacement for "Europe/Amsterdam". Providing this information to users would allow an easy upgrade path instead of having them rely on a legacy time zone via TimeZones("Europe/Amsterdam", TimeZones.Class(:LEGACY)) or choose an alternate time zone which may be incorrect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions