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

Provide user friendly exceptions with deprecated time zones #469

Open
omus opened this issue Sep 4, 2024 · 1 comment
Open

Provide user friendly exceptions with deprecated time zones #469

omus opened this issue Sep 4, 2024 · 1 comment
Milestone

Comments

@omus
Copy link
Member

omus commented Sep 4, 2024

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.

@omus
Copy link
Member Author

omus commented Sep 10, 2024

Deprecations are commonly included in minor version bumps for Julia packages. The difference here is that TimeZones.jl doesn't allow the use of legacy/deprecated time zones by default. I could see an argument to be made for tying the default TimeZone.Class with the --depwarn flag and having --depwarn=error be the only mode where TimeZone.Class(:LEGACY) is disallowed.
JuliaTime/TZJData.jl#31 (comment)

@omus omus added this to the 1.19.0 milestone Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant