Module

Temporal.PlainMonthDay

Package
purescript-temporal
Repository
philippedev101/purescript-temporal

Construction and inspection of PlainMonthDay values.

A PlainMonthDay represents a month and day without a year component (e.g. 12-25). Useful for recurring annual dates like birthdays or holidays.

Note: PlainMonthDay has Eq but not Ord, because ordering month-day pairs without a year is ambiguous (leap day considerations).

#plainMonthDay Source

plainMonthDay :: Int -> Int -> Maybe PlainMonthDay

Construct from month (1–12) and day (1–31). Returns Nothing for invalid combinations (e.g. month 2, day 30).

#fromString Source

fromString :: String -> Maybe PlainMonthDay

Parse an ISO 8601 month-day string (e.g. "--12-25"). Returns Nothing for invalid strings.

#getMonthCode Source

getMonthCode :: PlainMonthDay -> String

Month code string (e.g. "M12" for December).

#getDay Source

getDay :: PlainMonthDay -> Int

Day of the month (1–31).

#with Source

with :: { day :: Int, month :: Int } -> PlainMonthDay -> Maybe PlainMonthDay

Create a modified copy with the given month and day. Returns Nothing if the result would be invalid.

#toPlainDate Source

toPlainDate :: Int -> PlainMonthDay -> Maybe PlainDate

Convert to a PlainDate by specifying a year. Out-of-range days are constrained — e.g. Feb 29 in a non-leap year yields Feb 28. Returns Nothing for truly invalid values.

#toString Source

toString :: PlainMonthDay -> String

Serialize to an ISO 8601 month-day string (e.g. "--12-25").

Re-exports from Temporal.Internal.Types

#PlainMonthDay Source

data PlainMonthDay

A month and day without a year component (e.g. 12-25).

Useful for recurring annual dates like birthdays or holidays.

Instances

#PlainDate Source

data PlainDate

A calendar date without a time component or time zone (e.g. 2024-03-15).

Use PlainDate for birthdays, holidays, and other dates where time of day is irrelevant. Do not use for scheduling events — use ZonedDateTime instead.

Instances