Giter Club home page Giter Club logo

kosherzmanim's Introduction

This project is at an alpha stage.

Things will break, and APIs will change. Do not use this in production yet.

Introduction

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

Installation

NPM:

npm install --save kosher-zmanim

UMD (browser):

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

Usage and Documentation

Importing

ES6 modules / Typescript:

import KosherZmanim from "kosher-zmanim";

Node:

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

UMD (browser):

For UMD, a global KosherZmanim object is exposed.

Library Usage:

const zmanimCalendar = new KosherZmanim.lib.ZmanimCalendar();

The KosherJava library has been ported to JS, following the original API as close as possible. This is exposed as KosherZmanim.lib.*, following the above example. You can instatiate or extend those classes as necessary, the same way you would in Java.

Simple usage

Alternatively, KosherZmanim can be instatiated, and then there are 2 utility methods: getZmanimJson(), and getZmanimXML().

const kosherZmanim = new KosherZmanim(options);
const zmanim = kosherZmanim.getZmanimJson();

(See here for an example).

options object

The options object has the following structure:

{
    date: Date | string | number;
    timeZoneId: string;
    locationName: string;
    latitude: number;
    longitude: number;
    elevation?: number;
    complexZmanim?: boolean
}

Note about how zmanim are calculated

The zmanim are calculated based on the day of year, which is not dependent on timezone. This means that the zmanim will be calculated for the location selected, on the day of year passed, and then displayed at the equivalent time in the selected timezone.

Breaking changes from KosherJava

  • AstronomicalCalendar.getTemporalHour() returns null instead of Long.MIN_VALUE if the calculations cannot be completed.

kosherzmanim's People

Contributors

behindthemath avatar

Watchers

Moshe Goldberg avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.