hodatime: A fully featured date/time library based on Nodatime

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

HodaTime is a full-featured date and time library for Haskell, inspired by Noda Time (and, in turn, Joda Time) and Erik Naggum's /The Long, Painful History of Time/.

It draws a clear line between physical time (instants, durations and intervals on a global time line) and civil time (calendar dates, local times and the calendar-and-zone rules that connect the two), so the type you are holding always tells you exactly what you can and cannot do with it.

Highlights:


[Skip to Readme]

Properties

Versions 0.1.1.1, 0.2.1.1, 1.0.0.0, 1.0.0.1.26.178.1, 1.1.0.0
Change log CHANGELOG.md
Dependencies array (<0.6), base (>=4.16 && <4.21), binary (<0.9), bytestring (<0.13), containers (<0.8), deepseq (>=1.4 && <1.6), directory (<1.4), exceptions (<0.11), filepath (<1.6), fingertree (>=0.1.3 && <0.2), formatting (<7.3), hashable (>=1.3 && <1.6), mtl (<2.4), parsec (<3.2), text (>=0.11.0.8 && <2.2), unix (<2.9), Win32 (<2.15) [details]
License BSD-3-Clause
Author Jason Johnson
Maintainer <jason.johnson.081@gmail.com>
Category Data, Time
Home page https://github.com/jason-johnson/hodatime
Bug tracker https://github.com/jason-johnson/hodatime/issues
Source repo head: git clone https://github.com/jason-johnson/hodatime
Uploaded by jason_j at 2026-08-02T13:52:48Z

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for hodatime-1.0.0.1.26.178.1

[back to package description]

Build Status Hackage

hodatime

A full-featured date and time library for Haskell, inspired by Noda Time (and, in turn, Joda Time) and Erik Naggum's The Long, Painful History of Time.

hodatime draws a clear line between physical time — instants, durations and intervals on a single global timeline — and civil time — calendar dates, local times, and the calendar-and-zone rules that connect the two. The type you are holding always tells you exactly what you can and cannot do with it, so whole classes of date/time mistakes simply do not type-check.

Features

Example

import Data.HodaTime.Calendar.Gregorian (calendarDate, Month(..))
import Data.HodaTime.CalendarDate (dayOfWeek, withCalendar, CalendarDate)
import Data.HodaTime.Pattern (format)
import Data.HodaTime.Pattern.CalendarDate (pR)
import qualified Data.HodaTime.Calendar.Julian as Julian

-- Dates are smart-constructed; a date that cannot exist is Nothing
valentines = calendarDate 14 February 2024     -- a valid date (Just ...)
notADate   = calendarDate 30 February 2024     -- Nothing

-- Read-only components are plain functions
valentinesDoW = dayOfWeek <$> valentines       -- Just Wednesday

-- Convert losslessly to another calendar (the target is chosen by the result type)
julianChristmas :: Maybe (CalendarDate Julian.Julian)
julianChristmas = withCalendar <$> calendarDate 25 December 2024   -- 12 December 2024 in the Julian calendar

-- Format with a pattern (pR is the ISO-8601 round-trip date pattern)
isoText = format pR <$> calendarDate 23 April 2024                 -- Just "2024-04-23"

Installing

cabal install hodatime

or add hodatime to the build-depends of your package.

Documentation

The full API documentation is on Hackage. Start with the Data.HodaTime module, which gives a guided tour of the core concepts.

Changelog

Release notes are published on the GitHub releases page.

Versioning

Git release tags are the version source of truth. On a commit tagged vX.Y.Z.W, scripts/sync-version.sh sets the Cabal package version to X.Y.Z.W; later commits use X.Y.Z.(W+1). CI runs the script before building or publishing. Run it locally after creating a tag to synchronize hodatime.cabal.

License

BSD-3-Clause. See LICENSE.