JuliaTime / TimeZones.jl

IANA time zone database access for the Julia programming language
Other
85 stars 54 forks source link

Parser is sensitive to leading zeros on timezone #244

Open alhirzel opened 4 years ago

alhirzel commented 4 years ago

The timezone parser is sensitive to leading zeros on the hour and minute.

@testset "Optional leading zero for timezone hour and minute" begin
    f(str) = ZonedDateTime(str, "y-m-dTH:M:S.sz")
    t = f("2000-01-01T00:00:00.0-00:00")
    @test t == f("2000-1-1T0:0:0.0-00:00")
    @test_broken t == f("2000-1-1T0:0:0.0-0:00")
    @test_broken t == f("2000-1-1T0:0:0.0-00:0")
end
omus commented 4 years ago

I'll note that it is not just leading zeroes as "2000-1-1T0:0:0.0-1:2" will also fail. This seems to be a rather unusual time zone format to be parsing. Can you provide more context as to where this format has come from?

alhirzel commented 4 years ago

It is indeed a somewhat pathological case, and I just wanted to point out that it differs from the parsing of the first part of the string. Feel free to kill this issue if you don't see a need to fix.