package catala

  1. Overview
  2. Docs
Compiler and library for the literate programming language for tax code specification

Install

dune-project
 Dependency

Authors

Maintainers

Sources

1.0.0-beta.tar.gz
md5=c41cbc1fa003e167bbc0bb1cd7723ab3
sha512=1e07951e2d73040bc0bea89f04bcb50c3a533323a7c7d8bac9ee9aa6be5233f795a32857421d04f17e52a841057cdc78b33f79fa239a17dd12de97a738c81999

doc/catala.dates_calc/Dates_calc/index.html

Module Dates_calcSource

Sourcetype date

A valid date in the standard Gregorian calendar.

Sourcetype period

A period can be any number and combination of days, months, years.

Sourceexception InvalidDate
Sourceexception AmbiguousComputation
Sourcetype date_rounding =
  1. | RoundUp
  2. | RoundDown
  3. | AbortOnRound
    (*

    When choosing AbortOnRound, functions may raise AmbiguousComputation.

    *)

Functions on dates

Sourceval make_date : year:int -> month:int -> day:int -> date
  • raises [InvalidDate]
Sourceval add_dates : ?round:date_rounding -> date -> period -> date
  • raises [AmbiguousComputation]
Sourceval sub_dates : date -> date -> period

The returned period is always expressed as a number of days.

Sourceval compare_dates : date -> date -> int
Sourceval date_to_ymd : date -> int * int * int
Sourceval format_date : Format.formatter -> date -> unit

Respects ISO8601 format.

Sourceval date_of_string : string -> date
Sourceval first_day_of_month : date -> date
Sourceval last_day_of_month : date -> date
Sourceval is_leap_year : int -> bool

Functions on periods

Sourceval make_period : years:int -> months:int -> days:int -> period
Sourceval neg_period : period -> period
Sourceval add_periods : period -> period -> period
Sourceval sub_periods : period -> period -> period
Sourceval mul_period : period -> int -> period
Sourceval format_period : Format.formatter -> period -> unit
Sourceval period_of_string : string -> period
Sourceval period_to_days : period -> int
  • raises [AmbiguousComputation]

    when the period is anything else than a number of days.

Sourceval period_to_ymds : period -> int * int * int