Git Product home page Git Product logo

jewish-date's Introduction

Jewish Date

Jewish Date is a fast and modern 2kb alternative to hebcal with an MIT license.

npm version Gzip Size License Build Status Code Coverage

Jewish Date is a fast and modern 2kB JavaScript library that provides a simple and efficient Gregorian-to-Hebrew and vice versa date converter. With an MIT license and seamless compatibility with all browsers, node.js, and TypeScript, Jewish Date is a reliable and efficient date converter that can help you convert dates between the Hebrew and Gregorian calendars with ease.

  • ๐Ÿ“ฆ 2kb mini library (minified & gzip)
  • ๐Ÿ“œ MIT License
  • ๐Ÿ”ง Easy to use
  • ๐Ÿ’ป Seamless compatibility with both Node.js and the browser

Getting Started

Installation

yarn add jewish-date

Or with npm

npm install jewish-date --save

Usage

TypeScript & ES6 example

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

const date = new Date("2023-05-09");
const jewishDate = toJewishDate(date);
console.log(jewishDate); // { year: 5783, monthName: "Iyyar", month: 8, day: 18 }

const jewishDateInEnglish = formatJewishDate(jewishDate);
console.log(jewishDateInEnglish); // 18 Iyyar 5783

const jewishDateInHebrew = toHebrewJewishDate(jewishDate);
console.log(jewishDateInHebrew); // { day: "ื™ืดื—", monthName: "ืื™ื™ืจ", year: "ื”ืชืฉืคืดื’" }

const jewishDateInHebrewStr = formatJewishDateInHebrew(jewishDate);
console.log(jewishDateInHebrewStr); // ื™ืดื— ืื™ื™ืจ ื”ืชืฉืคืดื’

const date2 = toGregorianDate({
  year: 5783,
  monthName: JewishMonth.Iyyar,
  day: 18,
});
console.log(date2); // Tue May 09 2023 00:00:00 GMT+0300 (Israel Daylight Time)

For ES5

Replace

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

With

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

License

Jewish Date is licensed under a MIT License.

jewish-date's People

Contributors

shmulik-kravitz avatar dependabot[bot] avatar ci 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.