Date
Core
A calendar day without a time of day or time zone.
Time.Posix remains the instant type (including DB columns). Convert with fromPosix / toPosix. Local midnight for zones with DST transitions may land on the previous or next civil day; prefer Time.utc or a fixed Time.customZone when you need a stable mapping.
Types
Date
type Date = Date IntA civil calendar date (year / month / day).
Values
fromPosix
fromPosix : Zone -> Posix -> DateLocal calendar date of posix in zone.
toPosix
toPosix : Zone -> Date -> PosixLocal midnight for this date in zone, as a Posix instant.
On DST spring-forward days, midnight may not exist; the returned instant is the best-effort offset-adjusted midnight. Prefer UTC for round-trips.
fromCalendarDate
fromCalendarDate : Int -> Month -> Int -> DateBuild a date from calendar parts. Invalid dates become clamped via the day-number encoding only when the month day exists; prefer validating callers.
year
year : Date -> IntCalendar year.
month
month : Date -> MonthCalendar month.
day
day : Date -> IntDay of month (1–31).
compare
compare : Date -> Date -> OrderOrder dates.
addDays
addDays : Int -> Date -> DateShift by a whole number of calendar days.
diffDays
diffDays : Date -> Date -> IntWhole days from from to to (to - from).
toIsoString
toIsoString : Date -> StringFormat as YYYY-MM-DD.