Skip to content

Commit

Permalink
Include Molad details in memo field of MevarchimChodeshEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
mjradwin committed Jan 7, 2021
1 parent 945d198 commit 8a06ae5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hebcal/core",
"version": "3.0.4",
"version": "3.1.0",
"author": "Michael J. Radwin (https://github.com/mjradwin)",
"contributors": [
"Eyal Schachter (https://github.com/Scimonster)",
Expand Down
7 changes: 7 additions & 0 deletions src/holidays.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import {Locale} from './locale';
import {HDate, months} from './hdate';
import {Event, flags} from './event';
import {MoladEvent} from './molad';

/** Represents a built-in holiday like Pesach, Purim or Tu BiShvat */
export class HolidayEvent extends Event {
Expand Down Expand Up @@ -116,6 +118,11 @@ export class MevarchimChodeshEvent extends Event {
constructor(date, monthName) {
super(date, `${mevarchimChodeshStr} ${monthName}`, flags.SHABBAT_MEVARCHIM);
this.monthName = monthName;
const hyear = date.getFullYear();
const hmonth = date.getMonth();
const monNext = (hmonth == HDate.monthsInYear(hyear) ? months.NISAN : hmonth + 1);
const molad = new MoladEvent(date, hyear, monNext);
this.memo = molad.render();
}
/**
* Returns (translated) description of this event
Expand Down
5 changes: 5 additions & 0 deletions src/holidays.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ test('basename-and-url', (t) => {
t.is(mvch.url(), undefined);
});

test('MevarchimChodeshEvent', (t) => {
const mvch = new MevarchimChodeshEvent(new HDate(23, months.KISLEV, 5769), 'Tevet');
t.is(mvch.memo, 'Molad Tevet: Sat, 10 minutes and 16 chalakim after 16:00');
});

test('shushan-purim', (t) => {
const events = HebrewCalendar.calendar({year: 2015, numYears: 15});
const shushan = events.filter((ev) => ev.getDesc() == 'Shushan Purim');
Expand Down

0 comments on commit 8a06ae5

Please sign in to comment.