package lunar
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
A very small date management library
Install
dune-project
Dependency
Authors
Maintainers
Sources
lunar-1.3.0.tbz
sha256=cc0dc0ca027423d1892392872f7be35ff2c1acc5579ddf895b60cd6c77534e4a
sha512=5a252698e6bf0eb23f41d61c5b56deee03c8e7ccc7dca11145388e9cf1a12e5046c3cb09ee3472fe67dca700387aa108616c9eb128e154faec0f6d11eaaf010a
doc/src/lunar.unix/lunar_unix.ml.html
Source file lunar_unix.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 39 40 41 42 43 44 45 46 47 48 49(* Copyright (c) 2026, Cargocut and the Lunar developers. All rights reserved. SPDX-License-Identifier: BSD-3-Clause *) let from_tm ({ tm_sec; tm_min; tm_hour; tm_mday; tm_mon; tm_year; _ } : Unix.tm) = let at = ( tm_hour , tm_min , (* NOTE: Seconds can be [60] because of leap seconds. so we let's the user dealing with that using operation Duration. *) Int.min tm_sec 59 ) and year = tm_year + 1900 and month = tm_mon + 1 and day = tm_mday in (* NOTE: Should never fail. *) Lunar.Datetime.make_exn' ~at ~year ~month ~day () ;; let utc time = time |> Unix.gmtime |> from_tm |> Lunar.Zoned_datetime.from_utc let tz_local time = let utc = time |> Unix.gmtime |> from_tm in let local = time |> Unix.localtime |> from_tm in Lunar.Timezone.compute_from ~utc ~local, local ;; let local time = let tz, dt = tz_local time in Lunar.Zoned_datetime.from_local_datetime ~tz dt ;; let tz time = fst (tz_local time) let tz_now () = let time = Unix.time () in tz time ;; let utc_now () = let time = Unix.time () in utc time ;; let local_now () = let time = Unix.time () in local time ;;
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>