Source file date_internal.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
open Catala_runtime
let of_ymd : code_location -> integer -> integer -> integer -> date =
fun pos y m d ->
try
Dates_calc.make_date ~year:(Z.to_int y) ~month:(Z.to_int m)
~day:(Z.to_int d)
with Dates_calc.InvalidDate ->
raise (Error (UncomparableDurations, [pos]))
let to_ymd : date -> integer * integer * integer =
fun (d : date) ->
let y, m, d = Dates_calc.date_to_ymd d in
Z.of_int y, Z.of_int m, Z.of_int d
let last_day_of_month : date -> date =
fun (d : date) -> Dates_calc.last_day_of_month d
let () =
Catala_runtime.register_module "Date_internal"
[
"of_ymd", Obj.repr of_ymd;
"to_ymd", Obj.repr to_ymd;
"last_day_of_month", Obj.repr last_day_of_month;
]
"*external*"