Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/hebrewcalendar/HebrewDateFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ export class HebrewDateFormatter {

// This method is only about formatting, so we shouldn't make any changes to the params passed in...
// eslint-disable-next-line @typescript-eslint/naming-convention
const _jewishCalendar = jewishCalendar.clone() as JewishCalendar;
const _jewishCalendar = jewishCalendar.clone();
_jewishCalendar.setJewishMonth(month);
formattedRoshChodesh = this.hebrewFormat ? HebrewDateFormatter.hebrewHolidays[JewishCalendar.ROSH_CHODESH]
: this.transliteratedHolidays[JewishCalendar.ROSH_CHODESH];
Expand Down
21 changes: 18 additions & 3 deletions src/hebrewcalendar/JewishCalendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ export class JewishCalendar extends JewishDate {
* @return the upcoming <em>parsha</em>.
*/
public getUpcomingParsha(): Parsha {
const clone: JewishCalendar = this.clone() as JewishCalendar;
const clone: JewishCalendar = this.clone();
const daysToShabbos: number = (Calendar.SATURDAY - this.getDayOfWeek() + 7) % 7;
if (this.getDayOfWeek() !== Calendar.SATURDAY) {
clone.forward(Calendar.DATE, daysToShabbos);
Expand Down Expand Up @@ -1270,8 +1270,8 @@ export class JewishCalendar extends JewishDate {
*/
public isPurim(): boolean {
return this.isMukafChoma
? this.getYomTovIndex() === JewishCalendar.SHUSHAN_PURIM
: this.getYomTovIndex() === JewishCalendar.PURIM;
? this.getYomTovIndex() === JewishCalendar.SHUSHAN_PURIM
: this.getYomTovIndex() === JewishCalendar.PURIM;
}

/**
Expand Down Expand Up @@ -1503,6 +1503,21 @@ export class JewishCalendar extends JewishDate {
return holidayIndex === JewishCalendar.ISRU_CHAG;
}

/**
* A method that creates a <a href="https://en.wikipedia.org/wiki/Object_copy#Deep_copy">deep copy</a> of the object.
*
* @see Object#clone()
*/
public clone(): JewishCalendar {
const clone: JewishCalendar = new JewishCalendar(this.getJewishYear(), this.getJewishMonth(), this.getJewishDayOfMonth());
clone.setMoladHours(this.getMoladHours());
clone.setMoladMinutes(this.getMoladMinutes());
clone.setMoladChalakim(this.getMoladChalakim());
clone.setInIsrael(this.getInIsrael());
clone.setIsMukafChoma(this.getIsMukafChoma());
return clone;
}

/**
* Indicates whether some other object is "equal to" this one.
* @see Object#equals(Object)
Expand Down