hebcal / hebcal-js

⛔️ DEPRECATED - a perpetual Jewish Calendar (JavaScript)
GNU General Public License v3.0
124 stars 40 forks source link

What exactly is a standard options string? #44

Closed obihill closed 5 years ago

obihill commented 6 years ago

Firstly, great thanks for this amazing plugin. Using it for a Torah-inspired project.

I'm using it on Node.js and it's been a good experience so far.

The word options appears 6 times in the documentation, specifically referring to a standard options string. What exactly does the documentation mean by a standard options string?

mcblum commented 6 years ago

@obihill I don't suppose you're using it to fetch the next Torah portion are you? If so could you share a bit of code? I can't seem to figure out how to do that.

obihill commented 6 years ago

@mcblum Sure. Here's how to fetch a Torah portion [using node].

var Hebcal = require('hebcal');
var parsha_arr = new Hebcal.HDate(12, 1, 5778).getSedra('a');
var parsha_str = parsha_arr.join('-');

Note that the date I listed is a hebrew date. If you're using gregorian date you would change the code to this:

var Hebcal = require('hebcal');
var parsha_arr = new Hebcal.HDate(new Date(2018, 2, 28)).getSedra('a');
var parsha_str = parsha_arr.join('-');

Note that for gregorian, the month is 0-based i.e. 0 is January, 1 is February, etc.

It looks like 'a' argument in the getSedra method is for English, and 'h' is for Hebrew. I was just a little curious as to the foundation for that.

Cheers.

Scimonster commented 6 years ago

a is Ashkenazi, s is Sefardi, h is Hebrew.

This is mentioned kind of in passing in the README here.

mcblum commented 6 years ago

@obihill thank you! I missed this somehow but was just getting back to dev on this and saw the comment form @Scimonster. I really appreciate it :)