diff --git a/opam b/opam index 17f8645f..2dbec1b2 100644 --- a/opam +++ b/opam @@ -30,6 +30,7 @@ depends: [ "yojson" {>= "1.6.0"} "resource-pooling" {>= "1.0" & < "2.0"} "cohttp-lwt-unix" + "js_of_ocaml" {>= "5.5.0"} "re" {>= "1.7.2"} ] depexts: [ diff --git a/src/os_date.eliom b/src/os_date.eliom index 00b2a7bd..6b0cc23a 100644 --- a/src/os_date.eliom +++ b/src/os_date.eliom @@ -141,14 +141,20 @@ let to_utc ?(timezone = user_tz ()) d = let%client to_local d = let d = CalendarLib.Calendar.to_unixfloat d in - let o = (new%js Js.date_fromTimeValue (d *. 1000.))##getTimezoneOffset in + let o = + (new%js Js.date_fromTimeValue (Js.float (d *. 1000.)))##getTimezoneOffset + in CalendarLib.Calendar.from_unixfloat (d -. (float o *. 60.)) let%client to_utc d = let d = CalendarLib.Calendar.to_unixfloat d in - let o = (new%js Js.date_fromTimeValue (d *. 1000.))##getTimezoneOffset in + let o = + (new%js Js.date_fromTimeValue (Js.float (d *. 1000.)))##getTimezoneOffset + in let d' = d +. (float o *. 60.) in - let o' = (new%js Js.date_fromTimeValue (d' *. 1000.))##getTimezoneOffset in + let o' = + (new%js Js.date_fromTimeValue (Js.float (d' *. 1000.)))##getTimezoneOffset + in CalendarLib.Calendar.from_unixfloat (if o = o' then d' (* We guessed the DST status right *)