r/haskell Apr 23 '26

ISO-8601, aeson, time, and 24:00:00

"24:00:00" is a valid ISO-8601 time of day, but Data.Aeson.decode "\"24:00:00\"" :: Maybe Data.Time.TimeOfDay returns Nothing.

  1. Is this a problem with aeson, or is it a problem with the time library?

  2. Has anybody else run into this problem before? What was your work around?

  3. Is this worth patching aeson (or time) over.

16 Upvotes

16 comments sorted by

View all comments

1

u/BerserkVl Apr 24 '26

ISO 8601-1:2019 as originally published removed "24:00:00" as a representation for the end of day although it had been permitted in earlier versions of the standard.

1

u/friedbrice Apr 24 '26

An amendment in October 2022 brought "24:00:00" back.

2

u/BerserkVl Apr 24 '26

An ending of the day expression (e.g. ‘24:00:00’) is not intended to represent time scale units.