TemporalZmanim is a TS/JS port of the KosherJava library, rewritten to match Temporal standards (nanosecond based support, accurate TimeZone offsets). It is based on KosherZmanim, which is a direct port of KosherJava to TS.
- Either install from pnpm (
pnpm install temporal-zmanim
) or (web/Deno only) import from skypack. - Import the library using ESM imports (
import * as KosherZmanim from "kosher-zmanim";
) - Use the API the same way you would use KosherJava, except replace Java-specific imports with JS counterparts:
shaahZmanis
functions return aTemporal.Duration
rather than an integer with milliseconds- Other functions from the AstronomicalCalendar/ZmanimCalendar/ComplexZmanimCalendar classes will return a
Temporal.ZonedDateTime
- Input for all classes will use a
Temporal.PlainDate
, since TimeZone data is stored in theGeoLocation
class
AstronomicalCalendar.getTemporalHour()
returnsnull
instead ofLong.MIN_VALUE
if the calculations cannot be completed.- JS/TS does not have a parallel to Java's
Long.MIN_VALUE
, soLong_MIN_VALUE
is set toNaN
. - The following methods are not supported:
AstronomicalCalendar.toString()
AstronomicalCalendar.toJSON()
(UseZmanimFormatter.toJSON(astronomicalCalendar)
instead).AstronomicalCalculator.getDefault()
(Usenew NOAACalculator()
instead).JewishCalendar.getDafYomiBavli()
(UseYomiCalculator.getDafYomiBavli(jewishCalendar)
instead).JewishCalendar.getDafYomiYerushalmi()
(UseYerushalmiYomiCalculator.getDafYomiYerushalmi(jewishCalendar)
instead).Time.toString()
(Usenew ZmanimFormatter(TimeZone.getTimeZone("UTC")).format(time)
instead).ZmanimFormatter.toXML()
- The
Zman
class uses public members instead of getters and setters. AstronomicalCalendar.getTimeOffset
has been removed due to redundancy and either way not working like the original implementation