package timmy-jsoo
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
Js_of_ocaml bindings for Timmy
Install
dune-project
Dependency
Authors
Maintainers
Sources
1.0.0.tar.gz
md5=8ff18d53b9432f7d944adc31230736ff
sha512=0395308f402131b0333a8ee94c878d78e7698573e1c6bc943911692003b8d81949598e524e7ce0c9438cd4a3cf6298a58a868b24df7b5a5e1342ea263bd51a60
doc/src/timmy-jsoo.clock/clock.ml.html
Source file clock.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 31 32 33 34 35 36 37 38 39include Timmy.Timezone module Js = Js_of_ocaml.Js let now () = Ptime_clock.now () |> Timmy.Time.of_ptime (* JS Date's getTimezoneOffset is designed so that date + offset = GMT. Timmy computes the offset from GMT, date - offset = GMT. *) let timezone_local = let offset_calendar_time_s ~date:(year, month, day) ~time:(hours, minutes, seconds) = let () = let is_input_ok = Result.is_ok (Timmy.Date.of_tuple (year, month, day)) && Result.is_ok (Timmy.Daytime.of_tuple (hours, minutes, seconds)) in match is_input_ok with | true -> () | false -> Fmt.failwith "Given date and time %04i-%02i-%02i at %02i:%02i:%02i are not valid" year month day hours minutes seconds in let js_date = new%js Js.date_sec year (month - 1) day hours minutes seconds in js_date##getTimezoneOffset * 60 * -1 and offset_timestamp_s ~unix_timestamp = let () = if Int64.compare 0L unix_timestamp > 0 then Fmt.failwith "Given timestamp is negative" in let js_date = new%js Js.date_fromTimeValue (Int64.to_float unix_timestamp *. 1000.0) in js_date##getTimezoneOffset * 60 * -1 in of_implementation ~offset_calendar_time_s ~offset_timestamp_s let today () = Timmy.Date.of_time ~timezone:timezone_local @@ now ()
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>