Module Content_types.Date

A calendar date parsed from an ISO "YYYY-MM-DD" frontmatter string.

t is abstract and can only be produced by Date.of_string, which rejects anything malformed. An invalid date is therefore unrepresentable — there is no way to construct one and no later parse step that can fail.

type t
val of_string : string -> t option

Parse "YYYY-MM-DD"; None for any malformed or out-of-range input.

val to_iso_string : t -> string

Render back to ISO "YYYY-MM-DD".

val compare : t -> t -> int

Total chronological order (oldest < newest).

val compare_opt_desc : t option -> t option -> int

Newest-first comparator for t option sort keys; undated sorts last.

val year : t -> int
val month : t -> int
val day : t -> int