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.tar.gz
md5=42196e9a9c5e12839b38cb3da935f10c
sha512=ede2d8c17dcb936c1c8c596f1453bf89370a2f824a190efe74e438d7d7f7f83875c1ecbc18219c6a8a3e98b3ab4da1c3a6cc4e534687dbc90f3dca8230f43f7b

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