Convert date objects into Hebrew calendar dates. TypeScript fork of hebrew-date.
npm install hebrew-date-ts> Convert date objects into Hebrew calendar dates. TypeScript fork of hebrew-date.
This package is a TypeScript port of the original hebrew-date package by Ionică Bizău. The only change is the addition of TypeScript support and type definitions. All credit for the original implementation goes to the original author.
If you'd like to support the original author, please visit: https://github.com/IonicaBizau/hebrew-date
``shUsing npm
npm install hebrew-date-ts
Usage
`ts
import { hebrewDate } from "hebrew-date-ts";// Using year, month, day (month is one-indexed, January = 1)
console.log(hebrewDate(2016, 10, 2));
// { year: 5776, month: 13, date: 29, month_name: 'Elul' }
// Using a Date object
const october = 9; // zero-indexed for Date constructor
console.log(hebrewDate(new Date(2016, october, 3)));
// { year: 5777, month: 1, date: 1, month_name: 'Tishri' }
`$3
`js
const { hebrewDate } = require("hebrew-date-ts");console.log(hebrewDate(2016, 10, 2));
// { year: 5776, month: 13, date: 29, month_name: 'Elul' }
`API
$3
$3
Convert Gregorian dates into Hebrew calendar dates.
#### Parameters
- inputDate (
Date): A Date object representing the Gregorian date, OR
- year (number): The Gregorian year
- month (number): The Gregorian month (one-indexed, January being 1!)
- day (number): The Gregorian day of month#### Returns
HebrewDateResult - An object containing:
- year (number): The Hebrew year
- month (number): The Hebrew month (1-13)
- date (number): The Hebrew day of month
- month_name (string): The Hebrew month nameTypeScript
Full TypeScript support with exported types:
`ts
import { hebrewDate, HebrewDateResult } from "hebrew-date-ts";const result: HebrewDateResult = hebrewDate(new Date());
console.log(result.year); // number
console.log(result.month); // number
console.log(result.date); // number
console.log(result.month_name); // string
``For issues related to the TypeScript port, please open an issue at https://github.com/MendyLanda/hebrew-date-ts/issues.
For issues related to the core date conversion logic, please consider contributing to the original project at https://github.com/IonicaBizau/hebrew-date.
MIT - Original implementation by Ionică Bizău, TypeScript port by Mendy Landa.