JSPM

  • Created
  • Published
  • Downloads 4348
  • Score
    100M100P100Q133233F
  • License MIT

Package Exports

  • jewish-date
  • jewish-date/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (jewish-date) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Jewish Date · GitHub license main workflow Code Coverage npm version

Jewish Date is a Hebrew date to Gregorian date and vice verser converter.

Installation

yarn add jewish-date

Or with npm

npm install jewish-date --save

Usage

TypeScript & ES6 example

import {
  toJewishDate, toGregorianDate, formatJewishDateInHebrew, toHebrewJewishDate, JewishMonth
} from "jewish-date";

const date = new Date("2020-01-01");
const jewishDate = toJewishDate(date);
console.log(jewishDate); // { year: 5780, monthName: "Tevet", month: 4, day: 4 }

const jewishDateInEnglish = formatJewishDate(jewishDate);
console.log(jewishDateInEnglish); // 4 Tevet 5780

const jewishDateInHebrew = toHebrewJewishDate(jewishDate);
console.log(jewishDateInHebrew); // { day: "ד׳", monthName: "טבת", year: "התש״פ" }

const jewishDateInHebrewStr = formatJewishDateInHebrew(jewishDate);
console.log(jewishDateInHebrewStr); // ד׳ טבת התש״פ

const date2 = toGregorianDate({ year: 5780, monthName: JewishMonth.Tevet, day: 4 });
console.log(date2); // Wed Jan 01 2020 00:00:00 GMT+0200 (Israel Standard Time)

For ES5

Replace

import {
  toJewishDate, toGregorianDate, formatJewishDateInHebrew, toHebrewJewishDate
} from "jewish-date";

With

const {
  toJewishDate, toGregorianDate, formatJewishDateInHebrew, toHebrewJewishDate
} = require("jewish-date");

License

Jewish Date is MIT licensed.