package calendar

  1. Overview
  2. Docs

Date interface. A date may be seen as a triple (year, month, day).

All the dates should belong to [January, 1st 4713 BC; January 22th, 3268 AC] (called the Julian period). An Out_of_bounds exception is raised if you attempt to create a date outside the Julian period.

If a date d does not exists and if d_bef (resp. d_aft) is the last (resp. first) existing date before (resp. after) d, d is automatically coerced to d_aft + d - d_bef - 1. For example, both dates "February 29th, 2003" and "February 30th, 2003" do not exist and they are coerced respectively to the date "Mars 1st, 2003" and "Mars 2nd, 2003". This rule is called the coercion rule. As an exception to the coercion rule, the date belonging to [October 5th, 1582; October 14th, 1582] do not exist and an Undefined exception is raised if you attempt to create such a date. Those dropped days correspond to the change from the Julian to the Gregorian calendar.

module type S = sig ... end

Common operations for all date representations.