mirror of
https://github.com/CatalaLang/catala.git
synced 2024-11-08 07:51:43 +03:00
Fixes #134
This commit is contained in:
parent
2cb8b39308
commit
4ef0f660df
@ -33,7 +33,7 @@ let format_lit (fmt : Format.formatter) (l : lit Pos.marked) : unit =
|
||||
(Runtime.integer_to_int (Runtime.month_number_of_date d))
|
||||
(Runtime.integer_to_int (Runtime.day_of_month_of_date d))
|
||||
| LDuration d ->
|
||||
let years, months, days = Runtime.duration_to_days_months_years d in
|
||||
let years, months, days = Runtime.duration_to_years_months_days d in
|
||||
Format.fprintf fmt "duration_of_numbers %d %d %d" years months days
|
||||
|
||||
let format_op_kind (fmt : Format.formatter) (k : Dcalc.Ast.op_kind) =
|
||||
|
@ -197,7 +197,7 @@ let duration_to_string (d : duration) : string =
|
||||
(fun fmt (d, l) -> Format.fprintf fmt "%d %s" d l))
|
||||
to_print
|
||||
|
||||
let duration_to_days_months_years (d : duration) : int * int * int = CalendarLib.Date.Period.ymd d
|
||||
let duration_to_years_months_days (d : duration) : int * int * int = CalendarLib.Date.Period.ymd d
|
||||
|
||||
let handle_default : 'a. (unit -> 'a) array -> (unit -> bool) -> (unit -> 'a) -> 'a =
|
||||
fun exceptions just cons ->
|
||||
|
@ -163,7 +163,7 @@ val date_of_numbers : int -> int -> int -> date
|
||||
|
||||
val duration_of_numbers : int -> int -> int -> duration
|
||||
|
||||
val duration_to_days_months_years : duration -> int * int * int
|
||||
val duration_to_years_months_days : duration -> int * int * int
|
||||
|
||||
val duration_to_string : duration -> string
|
||||
|
||||
|
@ -101,7 +101,7 @@ let rec embed_to_js (v : runtime_value) : Js.Unsafe.any =
|
||||
ignore (date##setUTCMilliseconds 0);
|
||||
Js.Unsafe.inject date
|
||||
| Duration d ->
|
||||
let days, months, years = duration_to_days_months_years d in
|
||||
let days, months, years = duration_to_years_months_days d in
|
||||
Js.Unsafe.inject (Js.string (Printf.sprintf "%dD%dM%dY" days months years))
|
||||
| Struct (name, fields) ->
|
||||
Js.Unsafe.inject
|
||||
|
Loading…
Reference in New Issue
Block a user