@hebcal/core
Version:
A perpetual Jewish Calendar API
30 lines (27 loc) • 1.04 kB
JavaScript
/*! @hebcal/core v5.10.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
import { HDate, months } from '@hebcal/hdate';
import { ParshaEvent } from './ParshaEvent.js';
import { getSedra } from './sedra.js';
/**
* Calculates weekly Torah Reading on Saturdays for entire year
* @param year Hebrew year
* @param il Israel (false for Diaspora)
* @returns an array of `ParshaEvent` occurring on Saturdays that contain a regular
* (non-holiday) Parashat HaShavua
*/
function parshaYear(year, il) {
const sedra = getSedra(year, il);
const startAbs = sedra.getFirstSaturday();
const endAbs = HDate.hebrew2abs(year, months.ELUL, 29);
const events = [];
for (let absDt = startAbs; absDt <= endAbs; absDt += 7) {
const parsha = sedra.lookup(absDt);
if (!parsha.chag) {
const ev = new ParshaEvent(parsha.hdate, parsha.parsha, il, parsha.num);
events.push(ev);
}
}
return events;
}
export { parshaYear };
//# sourceMappingURL=parshaYear.js.map