Skip to content

Commit

Permalink
Merge pull request #12 from MaxBGreenberg/forupstream
Browse files Browse the repository at this point in the history
Add bein hashmashos
  • Loading branch information
mjradwin authored Jan 30, 2024
2 parents 7b39dcc + c6c0ad9 commit 50cb48d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
3 changes: 1 addition & 2 deletions hebcal/candles.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ func dailyZemanim(date hdate.HDate, opts *CalOptions) []event.CalEvent {
{"Alot haShachar", z.AlotHaShachar()},
{"Misheyakir", z.Misheyakir()},
{"Misheyakir Machmir", z.MisheyakirMachmir()},
{"Dawn", z.Dawn()},
{"Sunrise", z.Sunrise()},
{"Kriat Shema, sof zeman (MGA)", z.SofZmanShmaMGA()},
{"Kriat Shema, sof zeman (GRA)", z.SofZmanShma()},
Expand All @@ -256,7 +255,7 @@ func dailyZemanim(date hdate.HDate, opts *CalOptions) []event.CalEvent {
{"Mincha Ketanah", z.MinchaKetana()},
{"Plag HaMincha", z.PlagHaMincha()},
{"Sunset", z.Sunset()},
{"Dusk", z.Dusk()},
{"Bein HaShemashot", z.BeinHashmashos()},
{"Tzeit HaKochavim", z.Tzeit(zmanim.Tzeit3SmallStars)},
}
events := make([]event.CalEvent, 0, len(times))
Expand Down
3 changes: 1 addition & 2 deletions hebcal/hebcal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,6 @@ func TestDailyZemanim(t *testing.T) {
"2021-11-27 Alot haShachar: 05:21",
"2021-11-27 Misheyakir: 05:47",
"2021-11-27 Misheyakir Machmir: 05:54",
"2021-11-27 Dawn: 06:18",
"2021-11-27 Sunrise: 06:49",
"2021-11-27 Kriat Shema, sof zeman (MGA): 08:35",
"2021-11-27 Kriat Shema, sof zeman (GRA): 09:11",
Expand All @@ -430,7 +429,7 @@ func TestDailyZemanim(t *testing.T) {
"2021-11-27 Mincha Ketanah: 14:19",
"2021-11-27 Plag HaMincha: 15:18",
"2021-11-27 Sunset: 16:17",
"2021-11-27 Dusk: 16:48",
"2021-11-27 Bein HaShemashot: 16:41",
"2021-11-27 Tzeit HaKochavim: 17:02",
}
assert.Equal(t, expected, actual)
Expand Down
7 changes: 7 additions & 0 deletions zmanim/zmanim.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,13 @@ func (z *Zmanim) Tzeit(angle float64) time.Time {
return z.timeAtAngle(angle, false)
}

// Rabbeinu Tam holds that bein hashmashos is a specific time between sunset and tzeis hakochavim
// One opinion on how to calculate this time is that it is 13.5 minutes before tzies 7.083
func (z *Zmanim) BeinHashmashos() time.Time {
tzeis:=z.Tzeit(Tzeit3MediumStars)
return tzeis.Add(-time.Duration(13.5 * float64(time.Minute)))
}

func (z *Zmanim) riseSetOffset(t time.Time, offset int, roundTime bool) time.Time {
if t == nilTime {
return t
Expand Down
4 changes: 2 additions & 2 deletions zmanim/zmanim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ func TestZmanimChicago(t *testing.T) {
zman.AlotHaShachar(),
zman.Misheyakir(),
zman.MisheyakirMachmir(),
zman.Dawn(),
zman.Sunrise(),
zman.SofZmanShma(),
zman.SofZmanShmaMGA(),
Expand All @@ -51,7 +50,7 @@ func TestZmanimChicago(t *testing.T) {
zman.MinchaKetana(),
zman.PlagHaMincha(),
zman.Sunset(),
zman.Dusk(),
zman.BeinHashmashos(),
zman.Tzeit(8.5),
}
actual := make([]string, 18)
Expand Down Expand Up @@ -107,6 +106,7 @@ func TestZmanimTelAviv(t *testing.T) {
zman.PlagHaMincha(),
zman.Sunset(),
zman.Dusk(),
zman.BeinHashmashos(),
zman.Tzeit(8.5),
}
actual := make([]string, 18)
Expand Down

0 comments on commit 50cb48d

Please sign in to comment.