Skip to content

Commit

Permalink
Skip zmanim that don't have a valid time
Browse files Browse the repository at this point in the history
  • Loading branch information
mjradwin committed Dec 11, 2023
1 parent e6a3579 commit 9473e15
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion hebcal/candles.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,9 @@ func dailyZemanim(date hdate.HDate, opts *CalOptions) []event.CalEvent {
}
events := make([]event.CalEvent, len(times))
for i, ev := range times {
events[i] = NewTimedEvent(date, ev.desc, event.ZMANIM, ev.t, 0, nil, opts)
if !ev.t.IsZero() {
events[i] = NewTimedEvent(date, ev.desc, event.ZMANIM, ev.t, 0, nil, opts)
}
}
return events
}
10 changes: 10 additions & 0 deletions zmanim/zmanim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,13 @@ func ExampleZmanim_Dusk() {
fmt.Println(dusk)
// Output: 0001-01-01 00:00:00 +0000 UTC
}

func TestZmanimAmsterdam(t *testing.T) {
assert := assert.New(t)
dt := time.Date(2023, time.May, 29, 12, 0, 0, 0, time.UTC)
location := zmanim.NewLocation("Amsterdam", "NL", 52.37403, 4.88969, "Europe/Amsterdam")
zman := zmanim.New(&location, dt)
alot := zman.AlotHaShachar()
assert.Equal(alot.IsZero(), true)
assert.Equal(time.Time{}, alot)
}

0 comments on commit 9473e15

Please sign in to comment.