LunarLunar is a minimal date and time library, based primarily on a proleptic Gregorian calendar, that focuses on simple operations. Its development is needs-driven, meaning that the library is open to contributions that add use cases not initially considered.
In particular, the library allows you to work with Time objects (a specific hour of the day), Date objects (a specific day of the year), Datetime objects (a combination of a Time and a Date), and Zoned_datetime objects (a Datetime associated with a Timezone).
The code (and the algorithms used) is designed to be as simple as possible and easy to extend (without any particular concern for performance... sorry).
Describes the low-level components used as utilities for describing dates.
module Era : sig ... endEra identifies the historical period relative to year numbering. In the Gregorian/ISO calendar there are two eras: BCE and CE. Since Lunar just support dates between the years 0000 (in an astronomic sense), BCE is probably never used.
module Month : sig ... endRepresentation of the months of the year, using an enumeration.
module Weekday : sig ... endRepresentation of the days of a week, using an enumeration.
All objects that are not associated with a time zone.
module Time : sig ... endRepresents a time from 00:00:00 to 23:59:59.
module Date : sig ... endRepresents a date (year, month, day).
Objects associated with a time zone.
module Timezone : sig ... endDescribes the offset of a time zone, used to describe time-zone datetime values.
module Zoned_datetime : sig ... endA Datetime.t associated with a Timezone.t.
The resolution allows you to truncate dates (and more). And durations are a low-level representation of a number of seconds.
module Resolution : sig ... endDescribes a resolution that allows, among other things, dates to be truncated. Since negative resolutions produce strange results, they are always converted to their absolute values.
module Duration : sig ... endDescribes a duration in seconds (Lunar is essentially a Calendar library, so greater precision does not seem particularly useful). This is the most primitive type in the library, and the API exposes minimal set of arithmetic operations.
Provides a generic way to describe orderable and iterable ranges.
module Range : sig ... endThe Range module allows you to create intervals between comparable data points (implementing Sigs.COMPARABLE).
module Sigs : sig ... endSet of reusable signatures for sharing behaviors, among other things.