Module

BetaCalendars.GridAlgebra.Civil

Package
purescript-betacalendars-grid-algebra
Repository
mateopedersen/purescript-betacalendars-grid-algebra

Bounded Gregorian civil-date arithmetic with no timestamps or time zones.

Years are restricted to 1 through 9999. Constructors keep dates valid, while stepping past that supported boundary returns Nothing.

#Year Source

newtype Year

A supported positive Gregorian year.

Instances

#year Source

year :: Int -> Maybe Year

Construct a supported Gregorian year.

#yearValue Source

yearValue :: Year -> Int

The numeric Gregorian year.

#Month Source

data Month

Gregorian month names in calendar order.

Constructors

Instances

#allMonths Source

allMonths :: Array Month

The twelve months in calendar order.

#monthNumber Source

monthNumber :: Month -> Int

One-based month number.

#monthFromNumber Source

monthFromNumber :: Int -> Maybe Month

Convert a one-based month number into its Gregorian month.

#DayOfMonth Source

newtype DayOfMonth

A one-based day number that can be validated against a specific month.

Instances

#dayOfMonthValue Source

dayOfMonthValue :: DayOfMonth -> Int

The numeric day of month.

#CivilDate Source

newtype CivilDate

A validated Gregorian civil date.

Instances

#civilDate Source

civilDate :: Year -> Month -> Int -> Maybe CivilDate

Construct a valid date, returning Nothing for an impossible day.

#dateYear Source

dateYear :: CivilDate -> Year

The year component of a date.

#dateMonth Source

dateMonth :: CivilDate -> Month

The month component of a date.

#dateDay Source

dateDay :: CivilDate -> DayOfMonth

The day component of a date.

#isLeapYear Source

isLeapYear :: Year -> Boolean

Gregorian leap-year rule, including century and 400-year exceptions.

#daysInMonth Source

daysInMonth :: Year -> Month -> Int

Number of days in a Gregorian month.

#firstDateOfMonth Source

firstDateOfMonth :: Year -> Month -> CivilDate

The first day of a month.

#lastDateOfMonth Source

lastDateOfMonth :: Year -> Month -> CivilDate

The last day of a month.

#nextDate Source

nextDate :: CivilDate -> Maybe CivilDate

Advance one civil day; returns Nothing after 9999-12-31.

#previousDate Source

previousDate :: CivilDate -> Maybe CivilDate

Move one civil day backward; returns Nothing before 0001-01-01.

#weekdayOf Source

weekdayOf :: CivilDate -> Weekday

Weekday of a civil date in the proleptic Gregorian calendar.