This commit is contained in:
Denis Merigoux 2021-06-20 22:07:39 +02:00
parent 2cb8b39308
commit 4ef0f660df
No known key found for this signature in database
GPG Key ID: EE99DCFA365C3EE3
4 changed files with 4 additions and 4 deletions

View File

@ -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) =

View File

@ -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 ->

View File

@ -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

View File

@ -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