package timedesc

  1. Overview
  2. Docs
type t
type error = [
  1. | `Does_not_exist
  2. | `Invalid_year of int
  3. | `Invalid_month of int
]
exception Error_exn of error

Constructors

val make : year:int -> month:int -> (t, error) result
val make_exn : year:int -> month:int -> t

Accessors

val year : t -> int
val month : t -> int
val year_month : t -> int * int

Comparison

val equal : t -> t -> bool
val lt : t -> t -> bool
val le : t -> t -> bool
val gt : t -> t -> bool
val ge : t -> t -> bool
val compare : t -> t -> int

Arithmetic

val add : ?years:int -> ?months:int -> t -> t
val sub : ?years:int -> ?months:int -> t -> t
val diff_months : t -> t -> int

Pretty-printing

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

Parsing

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

Innovation. Community. Security.