Module Temporal.Date

type t = date

A date (see date).

val of_days : int -> t

A date from days since 1970-01-01.

val to_days : t -> int

Days since 1970-01-01.

val of_ymd : (int * int * int) -> t option

A date from (year, month, day); None if out of range.

val to_ymd : t -> int * int * int

The (year, month, day) of a date.

val to_ordinal : t -> int

Days since 0001-01-01 (proleptic Gregorian ordinal).

val of_ordinal : int -> t

A date from a proleptic Gregorian ordinal.

val add_days : int -> t -> t

Add a number of days.

val diff_days : t -> t -> int

Difference in days (a - b).

val add_months : int -> t -> t option

Add a number of months, clamping the day to the month length; None if the result is out of the supported year range.

val compare : t -> t -> int

Compare two dates.

val equal : t -> t -> bool

Whether two dates are equal.

val to_iso8601 : t -> string

Format as "YYYY-MM-DD".

val of_iso8601 : string -> t option

Parse "YYYY-MM-DD"; None if invalid.

val to_string : t -> string

Alias for to_iso8601.