HORIZON HASKELLDocslts/ghc-9.14.x45dd5372026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 45dd537 · 2026-10-11

Modulethyme-0.4.1Haskell2010

Data.Thyme.Calendar

Calendar calculations.

Note that UTCTime is not Y294K-compliant, and Bounded instances for the various calendar types reflect this fact. That said, the calendar calculations by themselves work perfectly fine for a wider range of dates, subject to the size of Int for your platform.

  • 8 types
  • 23 values
  • Packagethyme-0.4.1
  • Exports31
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceCalendar.hs

Day

2 declarations
newtypenewtype Day
#

A calendar-agnostic day, internally represented as a count of days since 1858-11-17, the Modified Julian Day (MJD) epoch.

To convert a Day to the corresponding YearMonthDay in the Gregorian calendar, see gregorian.

> gregorian # YearMonthDay 2016 3 1
2016-03-01

Day is an instance of AffineSpace where Diff Day = Days, so arithmetic on Day and Days can be performed with the .-., .+^, and .-^ operators.

> gregorian # YearMonthDay 2016 3 1  .-.  gregorian # YearMonthDay 2016 2 1
29
> gregorian # YearMonthDay 2016 3 1 .-^ 1
2016-02-29

Other ways of viewing a Day include ordinalDate, and weekDate.

Instances25Bounded, Enum, Eq, Data, Ord, Read, …
  • Bounded DayDefined in thyme-0.4.1 · Data.Thyme.Calendar · orphan
  • Enum DayDefined in thyme-0.4.1 · Data.Thyme.Calendar.Internal
  • Eq DayDefined in thyme-0.4.1 · Data.Thyme.Calendar.Internal
  • Data DayDefined in thyme-0.4.1 · Data.Thyme.Calendar.Internal
  • Ord DayDefined in thyme-0.4.1 · Data.Thyme.Calendar.Internal
  • Read DayDefined in thyme-0.4.1 · Data.Thyme.Format · orphan
  • Show DayDefined in thyme-0.4.1 · Data.Thyme.Calendar.Internal
  • Ix DayDefined in thyme-0.4.1 · Data.Thyme.Calendar.Internal
  • Generic DayDefined in thyme-0.4.1 · Data.Thyme.Calendar.Internal
  • NFData DayDefined in thyme-0.4.1 · Data.Thyme.Calendar.Internal
  • Random DayDefined in thyme-0.4.1 · Data.Thyme.Calendar · orphan
  • Arbitrary DayDefined in thyme-0.4.1 · Data.Thyme.Calendar · orphan
  • CoArbitrary DayDefined in thyme-0.4.1 · Data.Thyme.Calendar.Internal
  • Hashable DayDefined in thyme-0.4.1 · Data.Thyme.Calendar.Internal
  • Unbox DayDefined in thyme-0.4.1 · Data.Thyme.Calendar.Internal
  • AffineSpace DayDefined in thyme-0.4.1 · Data.Thyme.Calendar.Internal
  • FormatTime DayDefined in thyme-0.4.1 · Data.Thyme.Format
  • ParseTime DayDefined in thyme-0.4.1 · Data.Thyme.Format
  • MVector MVector DayDefined in thyme-0.4.1 · Data.Thyme.Calendar.Internal
  • Vector Vector DayDefined in thyme-0.4.1 · Data.Thyme.Calendar.Internal
  • Thyme Day DayDefined in thyme-0.4.1 · Data.Thyme.Time.Core
  • type Rep Day = D1 ('MetaData "Day" "Data.Thyme.Calendar.Internal" "thyme-0.4.1-8dXOglKrqmj4dXkxwF5pRL" 'True) (C1 ('MetaCons "ModifiedJulianDay" 'PrefixI 'True) (S1 ('MetaSel ('Just "toModifiedJulianDay") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)))Defined in thyme-0.4.1 · Data.Thyme.Calendar.Internal
  • data MVector s DayDefined in thyme-0.4.1 · Data.Thyme.Calendar.Internal
  • data Vector DayDefined in thyme-0.4.1 · Data.Thyme.Calendar.Internal
  • type Diff Day = DaysDefined in thyme-0.4.1 · Data.Thyme.Calendar.Internal

Calendar

10 declarations
typetype Month = Int
#

Calendar month. January = 1

typetype DayOfMonth = Int
#

Calendar day-of-month, starting from 1.

datadata YearMonthDay
#

A strict triple of a Year, a Day, and a Month.

Instances19Bounded, Eq, Data, Ord, Show, Generic, …
typetype Years = Int
#

A duration/count of years.

typetype Months = Int
#

A duration/count of months.

typetype Days = Int
#

A duration/count of days.

Gregorian calendar

19 declarations

Note that using the Gregorian calendar for dates before its adoption (from 1582 onwards, but varies from one country to the next) produces a proleptic calendar, which may cause some confusion.

Orphan instances

7 instances