All Projects → BehindTheMath → KosherZmanim

BehindTheMath / KosherZmanim

Licence: other
Port of the KosherJava zmanim library to TypeScript

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to KosherZmanim

hebcal-es6
Hebcal, a perpetual Jewish Calendar (ES6)
Stars: ✭ 45 (+55.17%)
Mutual labels:  jewish-holidays, hebrew-calendar, hebrew-date, zmanim, daf-yomi
KosherCocoa
My Objective-C port of KosherJava. KosherCocoa enables you to perform sunrise-based and sunset-based calculations for Jewish prayer and calendar.
Stars: ✭ 49 (+68.97%)
Mutual labels:  jewish-holidays, zmanim
react-jewish-datepicker
React jewish datepicker
Stars: ✭ 41 (+41.38%)
Mutual labels:  hebrew-calendar, hebrew-date
TypeScript-Library-Checklist
Your pre-launch checklist.
Stars: ✭ 19 (-34.48%)
Mutual labels:  typescript-library
sqlweb
SqlWeb is an extension of JsStore which allows to use sql query for performing database operation in IndexedDB.
Stars: ✭ 38 (+31.03%)
Mutual labels:  typescript-library
rustic
rustic is a TypeScript library providing emulation of Rust's Option and Result types (and some useful wrappers for common js functions as well!)
Stars: ✭ 71 (+144.83%)
Mutual labels:  typescript-library
avro-typescript
TypeScript Code Generator for Apache Avro Schema Types
Stars: ✭ 19 (-34.48%)
Mutual labels:  typescript-library
constant-time-js
Constant-time JavaScript functions
Stars: ✭ 43 (+48.28%)
Mutual labels:  typescript-library
typed-machine
A strict Finite State Machine, written in TS
Stars: ✭ 21 (-27.59%)
Mutual labels:  typescript-library
fejl
Error-making utility for Node apps.
Stars: ✭ 30 (+3.45%)
Mutual labels:  typescript-library
rxjs-ninja
RxJS Operators for handling Observable strings, numbers, booleans and more
Stars: ✭ 68 (+134.48%)
Mutual labels:  typescript-library
karkas
A tiny template engine based on TypeScript
Stars: ✭ 14 (-51.72%)
Mutual labels:  typescript-library
react-picture-annotation
A simple annotation component.
Stars: ✭ 53 (+82.76%)
Mutual labels:  typescript-library
typesocket
🌐 TypeScript WebSockets library.
Stars: ✭ 24 (-17.24%)
Mutual labels:  typescript-library
jsonrpc-ts
A very flexible library for building JSON-RPC 2.0 endpoints
Stars: ✭ 19 (-34.48%)
Mutual labels:  typescript-library
youtube-deno
A Deno client library of the YouTube Data API.
Stars: ✭ 30 (+3.45%)
Mutual labels:  typescript-library
react-loading-icons
A TypeScript-React edition of Sam Herbert's amazing SVG Loaders.
Stars: ✭ 32 (+10.34%)
Mutual labels:  typescript-library
stan
🔨 Collection of front-end engineering tools
Stars: ✭ 19 (-34.48%)
Mutual labels:  typescript-library
tzientist
Scientist-like library for Node.js in TypeScript
Stars: ✭ 37 (+27.59%)
Mutual labels:  typescript-library
fluent-behavior-tree
Typescript/Javascript behavior tree library with a fluent API
Stars: ✭ 55 (+89.66%)
Mutual labels:  typescript-library

This project is at an alpha stage.

Things will break, and APIs might change. Be cautious using this in production. Additionally, not all methods have been tested for accuracy.

Introduction

Kosher Zmanim is a TS/JS port of the KosherJava library.

Installation

NPM:

npm install kosher-zmanim

UMD (browser):

<script src="https://unpkg.com/kosher-zmanim/dist/kosher-zmanim.min.js"></script>

It is highly recommended that you pin the version (e.g. https://unpkg.com/[email protected]/dist/kosher-zmanim.min.js), so updates don't break your app.

Usage and Documentation

Importing

ES6 modules / Typescript:

import * as KosherZmanim from "kosher-zmanim";

Or:

import { ComplexZmanimCalendar, getZmanimJson } from "kosher-zmanim";

CommonJS modules:

const KosherZmanim = require("kosher-zmanim");

Or:

const { ComplexZmanimCalendar, getZmanimJson } = require("kosher-zmanim");

UMD (browser):

For UMD, a global KosherZmanim object is exposed.

Library Usage:

The KosherJava library has been ported to JS, following the original API as close as possible. The classes are exposed as named exports. You can instantiate or extend those classes as necessary, the same way you would in Java.

const zmanimCalendar = new KosherZmanim.ZmanimCalendar();

See the KosherJava API documentation for more details.

Simple usage

Alternatively, there is a getZmanimJson() utility method.

const zmanim = KosherZmanim.getZmanimJson(options);

Check out the demo, and look at the code to see an example of how it's used.

options object

The options object has the following structure and defaults:

{
    date: Date | string | number = new Date(),
    timeZoneId: string
    locationName?: string,
    latitude: number,
    longitude: number,
    elevation?: number = 0,
    complexZmanim?: boolean = false,
}

Note about how zmanim are calculated

This library uses Luxon as a date/time library, since Javascript's Date object does not support setting timezones other than the system timezone. All class methods that return a DateTime object will be in UTC.

Breaking changes from KosherJava

  • AstronomicalCalendar.getTemporalHour() returns null instead of Long.MIN_VALUE if the calculations cannot be completed.
  • JS/TS does not have a parallel to Java's Long.MIN_VALUE, so Long_MIN_VALUE is set to NaN.
  • The following methods are not supported:
    • AstronomicalCalendar.toString()
    • AstronomicalCalendar.toJSON() (Use ZmanimFormatter.toJSON(astronomicalCalendar) instead).
    • AstronomicalCalculator.getDefault() (Use new NOAACalculator() instead).
    • JewishCalendar.getDafYomiBavli() (Use YomiCalculator.getDafYomiBavli(jewishCalendar) instead).
    • JewishCalendar.getDafYomiYerushalmi() (Use YerushalmiYomiCalculator.getDafYomiYerushalmi(jewishCalendar) instead).
    • Time.toString() (Use new ZmanimFormatter(TimeZone.getTimeZone("UTC")).format(time) instead).
    • ZmanimFormatter.toXML()
  • Some method signatures are different, due to the differences between Java and JS.
  • The Zman class uses public members instead of getters and setters.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].