Skip to content

Commit

Permalink
Support tzdata rules with full length month names (#472)
Browse files Browse the repository at this point in the history
  • Loading branch information
omus authored Sep 7, 2024
1 parent 9ff3214 commit cea9813
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "TimeZones"
uuid = "f269a46b-ccf7-5d73-abea-4c690281aa53"
authors = ["Curtis Vogt <[email protected]>"]
version = "1.18.0"
version = "1.18.1"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand Down
2 changes: 1 addition & 1 deletion src/tzdata/compile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ function Base.parse(::Type{Rule}, str::AbstractString)
from = from_str != "min" ? parse(Int, from_str) : nothing
to = to_str == "only" ? from : (to_str != "max" ? parse(Int, to_str) : nothing)
type_str == "-" || throw(ArgumentError("Unhandled rule type: \"$type_str\""))
month = MONTHS[month_str]
month = MONTHS[month_str[1:3]]

# Now we need to get the right anonymous function
# for determining the right day for transitioning
Expand Down
13 changes: 13 additions & 0 deletions test/tzdata/compile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,19 @@ end
@test parse_date("2019 Mar Sun>=8 3:00") == (DateTime(2019,3,10,3), 'w') # America/Metlakatla (2018h)
@test parse_date("2006 Apr Fri<=1 2:00") == (DateTime(2006,3,31,2), 'w') # Asia/Jerusalem (2019b)

@testset "parse Rule" begin
# tzdata 2024b introduced the use of a non-three letter month: April
# https://github.com/JuliaTime/TimeZones.jl/issues/471
rule = parse(Rule, "1931 only - April 30 0:00 1:00 D")
@test rule.from == 1931
@test rule.to == 1931
@test rule.month == 4
@test rule.on(rule.from, rule.month) == Date(1931, 4, 30)
@test rule.at == TimeOffset(0)
@test rule.at_flag == 'w'
@test rule.save == TimeOffset(3600)
@test rule.letter == "D"
end

### order_rules ###

Expand Down

2 comments on commit cea9813

@omus
Copy link
Member Author

@omus omus commented on cea9813 Sep 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/114716

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.18.1 -m "<description of version>" cea98136be0900a48d7248094eca77bb96c61eaa
git push origin v1.18.1

Please sign in to comment.