haskell / time

A time library
http://hackage.haskell.org/package/time
Other
118 stars 78 forks source link

Parsing ZonedTime from non-offset ISO 8601 #257

Open MangoIV opened 1 month ago

MangoIV commented 1 month ago

Currently the iso8601 parser fails when trying to parse a ZonedTime from a non-offset time stamp. I was wondering why it doesn’t succeed and just “assumes” utc.

thanks in advance!

AshleyYakeley commented 1 month ago

Do you have a code example?

MangoIV commented 1 month ago
-- >>> x @UTCTime
-- Just 2024-05-30 16:15:18 UTC
-- >>> x @ZonedTime
-- Nothing
x :: ISO8601 t => Maybe t 
x = iso8601ParseM "2024-05-30T16:15:18Z"

here I would assume that it would be fine to parse into utcToZonedTime utc

Kleidukos commented 3 weeks ago

@AshleyYakeley This was notably discovered in the Security Advisories tooling, but I don't doubt other people have found it on their own.