GithubHelp home page GithubHelp logo

betesh / hebcal Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 235 KB

Determines the date of Passover for a Gregorian year. Also includes boolean functions to check whether a date is a Jewish holiday. Javascript (requires jQuery) and Ruby.

License: MIT License

Ruby 43.32% JavaScript 56.68%

hebcal's Introduction

HebCal

Determines the date of Passover for a Gregorian year. Also includes boolean functions to check whether a date is a Jewish holiday, Fast Day or Rosh Chodesh. Supported languages: Javascript Ruby

Installation as a Ruby gem

Add this line to your application's Gemfile: gem 'hebcal' And then execute: $ bundle Or install it yourself as: $ gem install hebcal

General notes

  1. 3- and 4-digit years are supported, so the domain of valid years is 100-9999. For years before the Gregorian transition (1582), the transition is ignored and the proleptic Gregorian calendar is used.

Ruby Version

To Run Unit Tests

$ rake test

To Use

Calculating the date of Passover

  1. At the top of the file where the class is defined, declare require hebcal``

  2. In the class, declare include HebCal::Passover

  3. WhenIsPesach(yyyy) returns a Ruby Time object representing midnight on the first day of passover, where yyyy is the Gregorian year

    Note that the date returned is the first day of Pesach, not the day on which Pesach begins at sunset.

Finding out if a date is a holiday

  1. At the top of the file where the class is defined, declare require hebcal``

  2. In the desired class, declare include HebCal::Holidays

  3. IsPesach(d) returns true iff d is a Ruby Time object representing a date during Pesach. Note that the day on which Pesach begins at sunset returns false.

  4. The following functions work in a similar way to IsPesach():

  5. IsShavuot(), IsRoshHashanah(), IsYomKippur(), IsSukkot()

  6. IsRegel(): IsPesach() || IsShavuot || IsSukkot()

  7. IsMoed(): Hol HaMoed Pesach or Hol HaMoed Sukkot

  8. IsYomTov(): IsPesach() || IsShavuot() || IsRoshHashanah() || IsSukkot()) && !IsMoed()

    Note that IsYomTov(yk) == false, where yk is the date of Yom Kippur.

  9. IsPurim(), IsHanuka()

  10. Is10Tevet(), IsTaanitEster(), Is17Tamuz(), Is9Av(), IsFastOfGedalia()

  11. IsTaanit(): Is10Tevet() || IsTaanitEster() || Is17Tamuz() || Is9Av() || IsFastOfGedalia()

  12. IsRoshChodesh()

Javascript Version

To Run Unit Tests

  1. Open index.html in a browser. You should see a lot of green text saying that tests passed. If not, javascript may not be enabled in your browser. Scroll down to the bottom and verify that the summary says all tests passed.

To Use

  1. Include the javascript source file in your HTML page

  2. If using Ruby On Rails, you can declare //= require hebcal at the top of a javascript or coffeescript file

  3. To include the script explicitly in an html file,

    <script src="app/assets/javascripts/hebcal/passover.js" type="text/javascript"></script>

  4. All date formats are YYYY-mm-dd, where month is index from 1 (i.e. 1 == January, not the usual javascript index of 0 == January!) and YYYY is the Gregorian year.

  5. $.whenIsPesach(yyyy) returns a date in the above format, where yyyy is the Gregorian year.

    Note that the date returned is the first day of Pesach, not the day on which Pesach begins at sunset.

  6. $.isPesach(d) returns true iff d is a date during Pesach, in the above format. Note that the day on which Pesach begins at sunset returns false.

  7. The following functions work in a similar way to $.isPesach():

  8. $.isShavuot(), $.isRoshHashanah(), $.isYomKippur(), $.isSukkot();

  9. $.isRegel(): $.isPesach() || $.isShavuot() || $.isSukkot();

  10. $.isMoed(): Hol HaMoed Pesach or Hol HaMoed Sukkot;

  11. $.isYomTov(): ($.isPesach() || $.isSukkot() || $.isShavuot() || $.isRoshHashanah()) &amp;&amp; !$.isMoed();

    Note that isYomTov(yk) == false, where yk is the date of Yom Kippur.

  12. $.isPurim(), $.isHanuka()

  13. $.isRoshChodesh()

  14. $.is10Tevet(), $.isTaanitEster(), $.is17Tamuz(), $.is9Av(), $.isFastOfGedalia()

  15. $.isTaanit(): $.is10Tevet() || $.isTaanitEster() || $.is17Tamuz() || $.is9Av() || $.isFastOfGedalia()

hebcal's People

Contributors

betesh avatar kalmanh avatar

Watchers

 avatar

hebcal's Issues

Add holiday generator

So that you can just print a list, instead of seeking by trying one date at a time

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.