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:
shaahZmanisfunctions return aTemporal.Durationrather 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 theGeoLocationclass
AstronomicalCalendar.getTemporalHour()returnsnullinstead ofLong.MIN_VALUEif the calculations cannot be completed.- JS/TS does not have a parallel to Java's
Long.MIN_VALUE, soLong_MIN_VALUEis 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
Zmanclass uses public members instead of getters and setters. AstronomicalCalendar.getTimeOffsethas been removed due to redundancy and either way not working like the original implementation