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

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8174fa4 · 2026-10-11

Moduletime-compat-1.9.9Haskell2010

Data.Time.Calendar.Compat

  • 6 types
  • 1 class
  • 32 values

Days

3 declarations
newtypenewtype Day
#

The Modified Julian Day is a standard count of days, with zero being the day 1858-11-17.

Instances16Enum, Eq, Data, Ord, Read, Show, …
  • Enum DayDefined in time-1.16.0.1 · Data.Time.Calendar.Days
  • Eq DayDefined in time-1.16.0.1 · Data.Time.Calendar.Days
  • Data DayDefined in time-1.16.0.1 · Data.Time.Calendar.Days
  • Ord DayDefined in time-1.16.0.1 · Data.Time.Calendar.Days
  • Read DayDefined in time-1.16.0.1 · Data.Time.Format.Parse · orphan
  • Show DayDefined in time-1.16.0.1 · Data.Time.Calendar.Gregorian · orphan
  • Ix DayDefined in time-1.16.0.1 · Data.Time.Calendar.Days
  • Generic DayDefined in time-1.16.0.1 · Data.Time.Calendar.Days
  • NFData DayDefined in time-1.16.0.1 · Data.Time.Calendar.Days
  • Hashable DayDefined in time-compat-1.9.9 · Data.Time.Orphans · orphan
  • DayPeriod DayDefined in time-1.16.0.1 · Data.Time.Calendar.Days
  • FormatTime DayDefined in time-1.16.0.1 · Data.Time.Format.Format.Instances · orphan
  • ParseTime DayDefined in time-1.16.0.1 · Data.Time.Format.Parse.Instances · orphan
  • ISO8601 DayDefined in time-1.16.0.1 · Data.Time.Format.ISO8601

    yyyy-mm-dd [ISO 8601:2004(E) sec. 4.1.2.2 extended format]

  • Lift DayDefined in time-1.16.0.1 · Data.Time.Calendar.Days
  • type Rep Day = D1 ('MetaData "Day" "Data.Time.Calendar.Days" "time-1.16.0.1-ea35" 'True) (C1 ('MetaCons "ModifiedJulianDay" 'PrefixI 'True) (S1 ('MetaSel ('Just "toModifiedJulianDay") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer)))Defined in time-1.16.0.1 · Data.Time.Calendar.Days

DayPeriod

6 declarations
classclass Ord p => DayPeriod p where
#

The class of types which can be represented as a period of days.

Methods

Instances4DayPeriod
  • DayPeriod DayDefined in time-1.16.0.1 · Data.Time.Calendar.Days
  • DayPeriod MonthDefined in time-1.16.0.1 · Data.Time.Calendar.Month
  • DayPeriod QuarterDefined in time-1.16.0.1 · Data.Time.Calendar.Quarter
  • DayPeriod YearDefined in time-1.16.0.1 · Data.Time.Calendar.Gregorian · orphan
valueperiodFromDay :: DayPeriod p => Day -> (p, Int)
#

Get the period this day is in, with the 1-based day number within the period.

periodFromDay (periodFirstDay p) = (p,1)

CalendarDiffTime

6 declarations
datadata CalendarDiffDays
#
Instances13Eq, Data, Read, Show, Generic, Semigroup, …

Year, month and day

17 declarations
typetype Year = Integer
#

Year of Common Era (when positive).

typetype MonthOfYear = Int
#

Month of year, in range 1 (January) to 12 (December).

Gregorian calendar

14 declarations

Add months, with days past the last day of the month clipped to the last day. For instance, 2005-01-30 + 1 month = 2005-02-28.

Add years, matching month and day, with Feb 29th clipped to Feb 28th if necessary. For instance, 2004-02-29 + 2 years = 2006-02-28.

Add years, matching month and day, with Feb 29th rolled over to Mar 1st if necessary. For instance, 2004-02-29 + 2 years = 2006-03-01.

Calendrical difference, with as many whole months as possible. Has the property addGregorianDurationClip (diffGregorianDurationClip d2 d1) d1 = d2. For example, 2027-03-01 - 2027-01-31 = 1 month and 1 day.

Calendrical difference, with as many whole months as possible. Has the property addGregorianDurationRollOver (diffGregorianDurationRollOver d2 d1) d1 = d2. For example, 2027-03-01 - 2027-01-31 = 29 days.

valueisLeapYear :: Year -> Bool
#

Is this year a leap year according to the proleptic Gregorian calendar?

Week

7 declarations
datadata DayOfWeek
#
Instances14Enum, Eq, Data, Ord, Read, Show, …
valueweekAllDays :: DayOfWeek -> Day -> [Day]
#

Returns a week containing the given Day where the first day is the DayOfWeek specified.

Examples:

Example1 expression
weekAllDays Sunday (YearMonthDay 2022 02 21)[YearMonthDay 2022 2 20 .. YearMonthDay 2022 2 26]
Example1 expression
weekAllDays Monday (YearMonthDay 2022 02 21)[YearMonthDay 2022 2 21 .. YearMonthDay 2022 2 27]
Example1 expression
weekAllDays Tuesday (YearMonthDay 2022 02 21)[YearMonthDay 2022 2 15 .. YearMonthDay 2022 2 21]
valueweekFirstDay :: DayOfWeek -> Day -> Day
#

Returns the first day of a week containing the given Day.

Examples:

Example1 expression
weekFirstDay Sunday (YearMonthDay 2022 02 21)YearMonthDay 2022 2 20
Example1 expression
weekFirstDay Monday (YearMonthDay 2022 02 21)YearMonthDay 2022 2 21
Example1 expression
weekFirstDay Tuesday (YearMonthDay 2022 02 21)YearMonthDay 2022 2 15
valueweekLastDay :: DayOfWeek -> Day -> Day
#

Returns the last day of a week containing the given Day.

Examples:

Example1 expression
weekLastDay Sunday (YearMonthDay 2022 02 21)YearMonthDay 2022 2 26
Example1 expression
weekLastDay Monday (YearMonthDay 2022 02 21)YearMonthDay 2022 2 27
Example1 expression
weekLastDay Tuesday (YearMonthDay 2022 02 21)YearMonthDay 2022 2 21

Type aliases

1 declaration
patternpattern YearMonthDay :: Year -> MonthOfYear -> DayOfMonth -> Day
#

Bidirectional abstract constructor for the proleptic Gregorian calendar. Invalid values will be clipped to the correct range, month first, then day.