NaiveDate

NaiveDate

A date in the Gregorian calendar without a timezone.

Stored as an ISO 8601 ordinal date, i.e. year and day of year Dates before the start of the Gregorian calendar are extrapolated, so be careful with historical dates. Years are 1 indexed to match the Common Era, i.e. year 1 is 1 CE, year 0 is 1 BCE, year -1 is 2 BCE, etc. Day of the year is 0 indexed, i.e. 0 is the first day of the year.

unixEpoch : NaiveDate

The Unix epoch, 1970-01-01.

firstDayOfCE : NaiveDate

The first day of the common era, 0001-01-01.

fromYmd : I64, U8, U8 -> Result NaiveDate [ InvalidMonth, InvalidDay ]

Convert a year, month, and day to a NaiveDate.

fromOrdinalDate : I64, U16 -> Result NaiveDate [InvalidDayOfYear]

Convert a year and day of year to a NaiveDate.

The first day of the year is 1st January. Trying to convert the 0th day of the year or a day after the last day of the year returns an InvalidDayOfYear error.

fromDaysSinceCE : U64 -> NaiveDate

Convert a number of days since the Common Era to a NaiveDate.

The zeroth day of the Common Era is 31st December, 1 BCE, and the first day of the Common Era is 1st January, 1 CE.

toIsoStr : NaiveDate -> Str

Serialise a date to ISO format.

toYmd : NaiveDate -> { year : I64, month : U8, day : U8 }

Convert a NaiveDate to a year, month, and day.

getYear : NaiveDate -> I64

Get the year of a NaiveDate.

getMonth : NaiveDate -> U8

Get the month of a NaiveDate.

getDay : NaiveDate -> U8

Get the day of a NaiveDate.

withNaiveTime : NaiveDate, NaiveTime ->

Add a NaiveTime to a NaiveDate.