Skip to content

Commit 10f3812

Browse files
authored
Merge pull request #669 from ocsigen/wasm
Wasm support
2 parents e776db2 + b2650e1 commit 10f3812

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

opam

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ depends: [
3030
"yojson" {>= "1.6.0"}
3131
"resource-pooling" {>= "1.0" & < "2.0"}
3232
"cohttp-lwt-unix"
33+
"js_of_ocaml" {>= "5.5.0"}
3334
"re" {>= "1.7.2"}
3435
]
3536
depexts: [

src/os_date.eliom

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,20 @@ let to_utc ?(timezone = user_tz ()) d =
141141

142142
let%client to_local d =
143143
let d = CalendarLib.Calendar.to_unixfloat d in
144-
let o = (new%js Js.date_fromTimeValue (d *. 1000.))##getTimezoneOffset in
144+
let o =
145+
(new%js Js.date_fromTimeValue (Js.float (d *. 1000.)))##getTimezoneOffset
146+
in
145147
CalendarLib.Calendar.from_unixfloat (d -. (float o *. 60.))
146148

147149
let%client to_utc d =
148150
let d = CalendarLib.Calendar.to_unixfloat d in
149-
let o = (new%js Js.date_fromTimeValue (d *. 1000.))##getTimezoneOffset in
151+
let o =
152+
(new%js Js.date_fromTimeValue (Js.float (d *. 1000.)))##getTimezoneOffset
153+
in
150154
let d' = d +. (float o *. 60.) in
151-
let o' = (new%js Js.date_fromTimeValue (d' *. 1000.))##getTimezoneOffset in
155+
let o' =
156+
(new%js Js.date_fromTimeValue (Js.float (d' *. 1000.)))##getTimezoneOffset
157+
in
152158
CalendarLib.Calendar.from_unixfloat
153159
(if o = o'
154160
then d' (* We guessed the DST status right *)

0 commit comments

Comments
 (0)