2.0.1 • Published 5 months ago
jewish-calendar v2.0.1
Jewish Calendar
A comprehensive TypeScript library for Jewish calendar calculations, date conversions, and Zmanim (Jewish time calculations).
Features
- Convert between Gregorian and Hebrew dates
- Calculate Jewish holidays and special dates
- Determine Zmanim (halachic times) for any location
- Support for Parsha of the week calculations
- Hebrew date formatting
- Comprehensive handling of Jewish calendar rules
- Written in TypeScript with full type safety
- Well-documented API
- Thoroughly tested
Install
npm install jewish-calendar
Usage
import { HebrewDate, GregorianDate, Zmanim } from 'jewish-calendar';
// Convert Gregorian to Hebrew date
const hebrewDate = HebrewDate.fromGregorian(new Date());
console.log(hebrewDate.toString()); // Returns Hebrew date in English or Hebrew
// Get Zmanim for a location
const zmanim = new Zmanim({
latitude: 31.7767,
longitude: 35.2345,
elevation: 754,
timeZone: 'Asia/Jerusalem'
});
console.log(zmanim.getSunrise()); // Get sunrise time
console.log(zmanim.getSunset()); // Get sunset time
// Get upcoming holidays
const holidays = HebrewDate.getUpcomingHolidays();
API
HebrewDate
fromGregorian(date: Date): HebrewDate
Converts a Gregorian date to a Hebrew date.
toGregorian(): Date
Converts a Hebrew date to a Gregorian date.
Zmanim
constructor(options: ZmanimOptions)
Creates a new Zmanim calculator with the specified location options.
getSunrise(): Date
getSunset(): Date
getCandleLighting(): Date
getHavdalah(): Date
And many more methods for various halachic times.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. Make sure to read the contributing guidelines first.
License
MIT © Dovid