hebcal/hebcal-js

What exactly is a standard options string?

obihill opened this issue · 4 comments

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?

@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.

@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.

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

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

@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 :)