package spotlib

  1. Overview
  2. Docs
type t = {
  1. year : int;
  2. month : int;
  3. day : int;
}

Comparison should work correctly between valid dates

include Mtypes.Comparable with type t := t
val compare : t -> t -> int
val equal : t -> t -> bool
module Infix : sig ... end
val to_string : t -> string

Prints t in ISO8601's YYYY-MM-DD format

exception Parse_error
val of_string_exn : string -> t
val of_string : string -> (t, [> `Exn of exn ]) result

Parses string of ISO8601's YYYY-MM-DD format

val yday : t -> int

1--365 or 366

val wday : t -> int

0--6, 0 is Sunday

val diff : t -> t -> int
val random_with_invalid : unit -> t

Random value generator which may contain invalids like 2000/02/31

val random : unit -> t

Random value generator with valid dates from 1900-01-01 to 2099-12-31. For checking more boudnary conditions, 1,28,29,30 and 31 are chosen more frequently as days than the others.

val random_2038 : unit -> t

Same as random but culled so that the values are between 1970-01-01 and 2037-12-31

OCaml

Innovation. Community. Security.