Skip to content

Commit

Permalink
Add Chag HaBanot on the 1st day of Rosh Chodesh Tevet
Browse files Browse the repository at this point in the history
  • Loading branch information
mjradwin committed Dec 16, 2022
1 parent a378221 commit 630ac66
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
2 changes: 1 addition & 1 deletion hebcal/all_holidays_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ import (
)

func TestGetAllHolidaysForYear(t *testing.T) {
assert.Equal(t, 125, len(getAllHolidaysForYear(5783)))
assert.Equal(t, 126, len(getAllHolidaysForYear(5783)))
}
8 changes: 5 additions & 3 deletions hebcal/hebcal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func TestHebrewCalendarChanukahCandles(t *testing.T) {
}
events, err := hebcal.HebrewCalendar(&opts)
assert.Equal(nil, err)
assert.Equal(13, len(events))
assert.Equal(14, len(events))
expected := []string{
"2022-12-18 Chanukah: 1 Candle: 5:04",
"2022-12-19 Chanukah: 2 Candles: 5:05",
Expand All @@ -183,6 +183,7 @@ func TestHebrewCalendarChanukahCandles(t *testing.T) {
"2022-12-22 Chanukah: 5 Candles: 5:06",
"2022-12-23 Chanukah: 6 Candles: 4:00",
"2022-12-23 Candle lighting: 4:00",
"2022-12-24 Chag HaBanot",
"2022-12-24 Chanukah: 7 Candles: 5:20",
"2022-12-24 Rosh Chodesh Tevet",
"2022-12-24 Havdalah: 5:20",
Expand Down Expand Up @@ -388,6 +389,7 @@ func TestNoModern(t *testing.T) {
"2022-12-21 Chanukah: 4 Candles",
"2022-12-22 Chanukah: 5 Candles",
"2022-12-23 Chanukah: 6 Candles",
"2022-12-24 Chag HaBanot",
"2022-12-24 Chanukah: 7 Candles",
"2022-12-25 Chanukah: 8 Candles",
"2022-12-26 Chanukah: 8th Day",
Expand Down Expand Up @@ -532,7 +534,7 @@ func TestYear2(t *testing.T) {
}
events, err := hebcal.HebrewCalendar(&opts)
assert.Equal(t, nil, err)
assert.Equal(t, 126, len(events))
assert.Equal(t, 127, len(events))
}

func TestYear1(t *testing.T) {
Expand All @@ -542,5 +544,5 @@ func TestYear1(t *testing.T) {
}
events, err := hebcal.HebrewCalendar(&opts)
assert.Equal(t, nil, err)
assert.Equal(t, 78, len(events))
assert.Equal(t, 79, len(events))
}
7 changes: 7 additions & 0 deletions hebcal/holidays.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,13 @@ func getAllHolidaysForYear(year int) []event.HolidayEvent {
Emoji: chanukahEmoji,
ChanukahDay: 8})

// On the 1st day of Rosh Chodesh Tevet
events = append(events,
event.HolidayEvent{
Date: chanukah7,
Desc: "Chag HaBanot",
Flags: event.MINOR_HOLIDAY})

// Tisha BAv and the 3 weeks
var tamuz17 = hdate.New(year, hdate.Tamuz, 17)
if tamuz17.Weekday() == time.Saturday {
Expand Down
18 changes: 10 additions & 8 deletions hebcal/holidays_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

func TestGetHolidaysForYearArrayDiaspora(t *testing.T) {
events := hebcal.GetHolidaysForYear(5771, false)
assert.Equal(t, 109, len(events))
assert.Equal(t, 110, len(events))

expected := []string{
"2010-09-09 Rosh Hashana 5771",
Expand Down Expand Up @@ -46,6 +46,7 @@ func TestGetHolidaysForYearArrayDiaspora(t *testing.T) {
"2010-12-04 Shabbat Mevarchim Chodesh Tevet",
"2010-12-05 Chanukah: 5 Candles",
"2010-12-06 Chanukah: 6 Candles",
"2010-12-07 Chag HaBanot",
"2010-12-07 Chanukah: 7 Candles",
"2010-12-07 Rosh Chodesh Tevet",
"2010-12-08 Chanukah: 8 Candles",
Expand Down Expand Up @@ -137,7 +138,7 @@ func TestGetHolidaysForYearArrayDiaspora(t *testing.T) {

func TestGetHolidaysForYearArrayIL(t *testing.T) {
events := hebcal.GetHolidaysForYear(5720, true)
assert.Equal(t, 98, len(events))
assert.Equal(t, 99, len(events))

expected := []string{
"1959-10-03 Rosh Hashana 5720",
Expand Down Expand Up @@ -169,6 +170,7 @@ func TestGetHolidaysForYearArrayIL(t *testing.T) {
"1959-12-28 Chanukah: 4 Candles",
"1959-12-29 Chanukah: 5 Candles",
"1959-12-30 Chanukah: 6 Candles",
"1959-12-31 Chag HaBanot",
"1959-12-31 Chanukah: 7 Candles",
"1959-12-31 Rosh Chodesh Tevet",
"1960-01-01 Chanukah: 8 Candles",
Expand Down Expand Up @@ -447,15 +449,15 @@ func TestHolidayEmoji(t *testing.T) {

func TestHolidaysEarlyYears(t *testing.T) {
events := hebcal.GetHolidaysForYear(3763, false)
assert.Equal(t, 97, len(events))
assert.Equal(t, 98, len(events))
events = hebcal.GetHolidaysForYear(3762, false)
assert.Equal(t, 103, len(events))
assert.Equal(t, 104, len(events))
events = hebcal.GetHolidaysForYear(3761, false)
assert.Equal(t, 98, len(events))
assert.Equal(t, 99, len(events))
events = hebcal.GetHolidaysForYear(3760, false)
assert.Equal(t, 104, len(events))
assert.Equal(t, 105, len(events))
events = hebcal.GetHolidaysForYear(2, false)
assert.Equal(t, 98, len(events))
assert.Equal(t, 99, len(events))
events = hebcal.GetHolidaysForYear(1, false)
assert.Equal(t, 98, len(events))
assert.Equal(t, 99, len(events))
}

0 comments on commit 630ac66

Please sign in to comment.