Module NesPartialDate

Partial Date

This module implements the notion of partial date, that is a date from which the day or the month may be missing.

type t

The type of a partial date.

val equal : t -> t -> Ppx_deriving_runtime.bool
val pp : Ppx_deriving_runtime.Format.formatter -> t -> Ppx_deriving_runtime.unit
val show : t -> Ppx_deriving_runtime.string
val to_yojson : t -> Yojson.Safe.t
val of_yojson : Yojson.Safe.t -> t Ppx_deriving_yojson_runtime.error_or
val from_string : string -> t option

Parses the date from a potentially-truncated ISO 8601 string, eg. 2022-11-09, 2022-11 or 2022.

val to_string : t -> string

Prints the date as a potentially-truncated ISO 8601 string, eg. 2022-11-09, 2022-11 or 2022,

val to_pretty_string : ?at:bool -> ?short:bool -> t -> string

Prints the date as a pretty string, eg. 9 November 2022, November 2022 or 2022. The ?at argument allows to represent the string β€œat <date>”, eg. on 9 November 2022, in November 2022 or in 2022. The ?short argument makes the month name short, eg. 9 Nov 2022.

val compare : t -> t -> int

Compares two strings.