Module Date.Ymd

type view = private {
  1. year : int;
  2. month : int;
  3. day : int;
}
type error = [
  1. | `Does_not_exist
  2. | `Invalid_year of int
  3. | `Invalid_month of int
  4. | `Invalid_day of int
]
exception Error_exn of error
val make : year:int -> month:int -> day:int -> (t, error) Stdlib.result

Constructs a date in the Gregorian calendar.

Returns Error `Invalid_year if year < 0 || 9999 < year.

Returns Error `Invalid_month if month < 1 || 12 < month.

Returns Error `Invalid_day if day < 1 || day count of month < day.

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

Pretty-printing

val pp_iso8601 : Stdlib.Format.formatter -> t -> unit
val to_iso8601 : t -> string

Parsing

val of_iso8601 : string -> (t, string) Stdlib.result
val of_iso8601_exn : string -> t