package timmy-jsoo

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
include module type of struct include Timmy.Week end

A week of a year.

A week of a year.

Type

type t = private Timmy.Week.t = {
  1. year : int;
  2. n : int;
}

A week of a year.

Per ISO 8601 week date system, a week is attributed to the year its Thursday is in.

Construction

val make : year:Base.int -> Base.int -> (Timmy.Week.t, Base.string) Base.Result.t

make ~year n is { n; year } if it represents a valid week or a relevant error message otherwise.

Time manipulation

val days : Timmy.Week.t -> Timmy.Date.t Base.Sequence.t

days week is the sequence of dates in week in chronological order.

day week weekday is the weekday of week.

Time conversions

val to_date : Timmy.Week.t -> Timmy.Date.t

to_date week is the first day (Monday) of week

val of_date : Timmy.Date.t -> Timmy.Week.t

of_date date is the week that includes date

Comparison

include Base.Comparable.S with type t := t
val equal : Timmy.Week.t -> Timmy.Week.t -> bool
val compare : Timmy.Week.t -> Timmy.Week.t -> int
val ascending : Timmy.Week.t -> Timmy.Week.t -> int
val descending : Timmy.Week.t -> Timmy.Week.t -> int
val between : Timmy.Week.t -> low:Timmy.Week.t -> high:Timmy.Week.t -> bool
val clamp_exn : Timmy.Week.t -> min:Timmy.Week.t -> max:Timmy.Week.t -> Timmy.Week.t
val clamp : Timmy.Week.t -> min:Timmy.Week.t -> max:Timmy.Week.t -> Timmy.Week.t Base__.Or_error.t
type comparator_witness = Timmy.Week.comparator_witness
val comparator : (Timmy.Week.t, comparator_witness) Base__Comparator.comparator

Operators

module O = Timmy.Week.O

Convenience module to only pull operators.

include module type of O

Convenience module to only pull operators.

Convenience module to only pull operators.

Convenience module to only pull operators.

Convenience module to only pull operators.

include Base.Comparable.Infix with type t := Timmy__.Week.t
val (>=) : Timmy.Week.t -> Timmy.Week.t -> bool
val (<=) : Timmy.Week.t -> Timmy.Week.t -> bool
val (=) : Timmy.Week.t -> Timmy.Week.t -> bool
val (>) : Timmy.Week.t -> Timmy.Week.t -> bool
val (<) : Timmy.Week.t -> Timmy.Week.t -> bool
val (<>) : Timmy.Week.t -> Timmy.Week.t -> bool
val (+) : Timmy.Week.t -> Base.int -> Timmy.Week.t

time + span is the time point span after time.

Scalar conversions

Pretty-print

pp f week prints week to f in YYYY-NN format, eg. 2021-02.

String

val to_string : Timmy.Week.t -> Base.string

to_string week is the YYYY-WW representation of week, eg. 2022-03.

val of_string : Base.string -> (Timmy.Week.t, Base.string) Base.Result.t

of_string s is the week represented by s as yielded by to_string or a relevant error message if it is invalid.

OCaml

Innovation. Community. Security.