Hodatime is a date and time library for Haskell, inspired by Noda Time (itself, inspired by Joda Time) and Erik Naggum’s “The Long, Painful History of Time”.
This library is intended to be batteries included, which is in contrast to most of the existing Haskell date time work (elegant as they are). It continues the work of Jodatime and Nodatime, distinguishing between civil and physical time but, just as Nodatime tightened the type safety of Jodatime, Hodatime excludes even more incorrect code due to Haskell’s type system.
Highlights:
* Multiple calendars — Gregorian, ISO, Julian, Coptic, Persian (astronomical Solar Hijri), Islamic (parameterised over the leap-year rule), and Hebrew — with lossless conversion between them.
* Time zones read from the operating system (the IANA/Olson database on Unix, the registry on Windows), with explicit handling of skipped/ambiguous local times.
* A composable pattern system where one field definition yields both a parser and a formatter, so the two can’t drift apart.
* Locale-aware formatting driven by the host’s own locale data.
Internally an instant is counted from 1 March 2000, not the Unix epoch. The reasons, as discussed in Naggum’s work are: starting the year in March pushes February — and its awkward leap day — to the end of the year, so the leap day never shifts the offsets of any other month and the date arithmetic stays uniform. And anchoring at 2000, a leap year that begins a fresh 400-year Gregorian cycle, makes the internal cycle/century/day-in-century breakdown fall out cleanly. Each calendar is free to use whatever epoch is most natural for its own math; the shift onto the shared timeline happens only at the boundary.
It’s BSD-3-licensed, builds across GHC 9.4–9.10 on Linux/macOS/Windows, and has quietly been in development for years — 1.0 is the first release I’ve actually announced. Feedback very welcome.