hebcal/hebcal-es6

Pirkei Avot for summer Shabbat

PupaRebbe opened this issue · 7 comments

I wrote a function to calculate the Pirkei Avot being studied on Shabbat between Pesach and Rosh Hashana since i didn't find a built-in way to get it.
If i post it here does it have a chance to become a part of the project?

Thanks! This would be a great addition, and I believe may belong better in the @hebcal/learning package

https://github.com/hebcal/hebcal-learning

Would you like to open a pull request there?

I am not familiar enough with the Hebcal hierarchy to be able to write it the way it belongs, i also see that all learning schedules of @hebcal/learning are classes while my calculation is written as a simple JS function that takes a parameter and returns a value.
That's besides my poor knowledge in node.js and GitHub.
Can i post the function here and you will modify/optimize it and merge to the package?

Sure, post it here (or post it to https://gist.github.com/ ) and we will work to incorporate it into the learning schedules

Thanks! Taking a look at this and will work to incorporate in @hebcal/learning

@mjradwin well done. was theHebrewCalendar class updated to support Pirkei Avot?

Yes, you should be able to use the HebrewCalendar API to get Pirkei Avot as follows (assuming you have the most recent @hebcal/learning version 5.0.8)

import {HebrewCalendar} from '@hebcal/core';
import '@hebcal/learning';

const events = HebrewCalendar.calendar({
  year: 2024,
  noHolidays: true,
  dailyLearning: {
    pirkeiAvotSummer: true,
  },
});

console.log(events);

We did some testing for 5783 and 5784 in both Israel and Diaspora and your algorithm seemed to work really well! We adapted slightly but kept generally the same structure as your code. Let us know if the results looks correct to you!