zmanim 0.2.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.gitignore +0 -1
- data/CHANGELOG.md +51 -0
- data/Gemfile.lock +41 -0
- data/lib/zmanim/hebrew_calendar/hebrew_date_formatter.rb +6 -8
- data/lib/zmanim/hebrew_calendar/jewish_calendar.rb +266 -17
- data/lib/zmanim/hebrew_calendar/jewish_date.rb +45 -0
- data/lib/zmanim/limudim/calculators/daf_hashavua_bavli.rb +23 -0
- data/lib/zmanim/limudim/calculators/mishna_yomis.rb +1 -1
- data/lib/zmanim/limudim/calculators/parsha.rb +31 -31
- data/lib/zmanim/limudim/cycle.rb +0 -4
- data/lib/zmanim/limudim/limud.rb +4 -0
- data/lib/zmanim/limudim/limud_calculator.rb +1 -1
- data/lib/zmanim/limudim/limudim_formatter.rb +2 -1
- data/lib/zmanim/version.rb +1 -1
- data/lib/zmanim/zmanim_calendar.rb +54 -13
- data/zmanim.gemspec +2 -2
- metadata +12 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 106a751ffa4c28d37a4d69afc2d8aa91d8f07b668dc126f6008fec90c3a0b308
|
|
4
|
+
data.tar.gz: 8886864f89feb9382a62644de99201c4b0958ff2d8652728fad14ed1c6420df9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 971b9186fae5a3eccba8730038b9df6f2e5566d57fac6626dbbcba60ae87ec472eb73a2d72536f9dfbeee473cdd857c68f3c296a25dfad8feb65874f790a04ad
|
|
7
|
+
data.tar.gz: c73d548258fc576a7afaff89025a9c0b7105551e679284d0a291f03bbc91945b5f701bac5236eb6c882fba857ef185944fa879f813d069d11666c654c5f9142f
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,57 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [0.5.0] - 2022-03-24
|
|
8
|
+
### Added
|
|
9
|
+
- `JewishCalendar#taanis_bechorim?` detects Taanis Bechorim for a given date
|
|
10
|
+
- `JewishCalendar#pesach` returns the date for start of Pesach for any year, or the next upcoming event
|
|
11
|
+
- `JewishCalendar#pesach_sheni` returns the date for Pesach Sheni for any year, or the next upcoming event
|
|
12
|
+
- `JewishCalendar#lag_baomer` returns the date for Lag Baomer for any year, or the next upcoming event
|
|
13
|
+
- `JewishCalendar#shavuos` returns the date for start of Shavuos for any year, or the next upcoming event
|
|
14
|
+
- `JewishCalendar#seventeen_of_tammuz` returns the date for Seventeen of Tammuz for any year, or the next upcoming event
|
|
15
|
+
- `JewishCalendar#tisha_beav` returns the date for Tisha Beav for any year, or the next upcoming event
|
|
16
|
+
- `JewishCalendar#tu_beav` returns the date for Tu Beav for any year, or the next upcoming event
|
|
17
|
+
- `JewishCalendar#rosh_hashana` returns the date for start of Rosh Hashana for any year, or the next upcoming event
|
|
18
|
+
- `JewishCalendar#tzom_gedalyah` returns the date for Tzom Gedalyah for any year, or the next upcoming event
|
|
19
|
+
- `JewishCalendar#yom_kippur` returns the date for Yom Kippur for any year, or the next upcoming event
|
|
20
|
+
- `JewishCalendar#succos` returns the date for start of Succos for any year, or the next upcoming event
|
|
21
|
+
- `JewishCalendar#chanukah` returns the date for start of Chanukah for any year, or the next upcoming event
|
|
22
|
+
- `JewishCalendar#tenth_of_teves` returns the date for Tenth of Teves for any year, or the next upcoming event
|
|
23
|
+
- `JewishCalendar#tu_beshvat` returns the date for Tu Beshvat for any year, or the next upcoming event
|
|
24
|
+
- `JewishCalendar#purim` returns the date for Purim for any year, or the next upcoming event
|
|
25
|
+
- `JewishCalendar#rosh_chodesh` returns the date for Rosh Chodesh for any month, or the next upcoming event
|
|
26
|
+
- `JewishCalendar#shabbos_mevorchim` returns the date for Shabbos Mevorchim for any month, or the next upcoming event
|
|
27
|
+
- `JewishCalendar#vesein_tal_umatar_start` returns the date for start of reciting Vesein Tal Umatar for any year, or the next upcoming event
|
|
28
|
+
- `JewishCalendar#vesein_tal_umatar_starts?` detects if reciting of Vesein Tal Umatar started today
|
|
29
|
+
### Changed
|
|
30
|
+
- Upgraded dependency versions to address known security vulnerabilities:
|
|
31
|
+
- `rake` to 13.0.6
|
|
32
|
+
- `bundler` to 2.3.10
|
|
33
|
+
### Fixed
|
|
34
|
+
- `JewishCalendar#vesein_tal_umatar?` and `JewishCalendar#vesein_tal_umatar_starts_tonight?` now auto-adjust for any calendar year, previously only valid for 20th/21st century
|
|
35
|
+
|
|
36
|
+
## [0.4.0] - 2020-10-13
|
|
37
|
+
### Added
|
|
38
|
+
- `JewishCalendar#end_of_week` returns Shabbos for this week
|
|
39
|
+
- Parshas Hashavua modifier to return blank Limud if the standard Parsha is not read this Shabbos
|
|
40
|
+
- Daf Hashavua calculator
|
|
41
|
+
### Changed
|
|
42
|
+
- Refactor kviah calculation logic to JewishDate
|
|
43
|
+
- Remove formatter dependency for Parsha calculator
|
|
44
|
+
### Fixed
|
|
45
|
+
- Added Lag B'Omer as significant day / yom tov
|
|
46
|
+
- Fixed Lag B'Omer spelling for english formatted omer
|
|
47
|
+
|
|
48
|
+
## [0.3.0] - 2018-09-17
|
|
49
|
+
### Added
|
|
50
|
+
- Elevations used in shaos zmanios calculations if use_elevation property is set
|
|
51
|
+
- Hanetz and Shkia methods will use the appropriate calculation based on use_elevation setting
|
|
52
|
+
- Support Alos and Tzais offset using temporal minutes
|
|
53
|
+
- Various Assur Bemelacha related methods for calendar dates using JewishCalendar,
|
|
54
|
+
as well as point-in-time using ZmanimCalendar.
|
|
55
|
+
- Methods to determine Shabbos Mevorchim, first night of Vesein Tal Umatar,
|
|
56
|
+
and delayed candle lighting
|
|
57
|
+
|
|
7
58
|
## [0.2.2] - 2018-08-31
|
|
8
59
|
### Fixed
|
|
9
60
|
- Typo in formatted Masechtos
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
zmanim (0.5.0)
|
|
5
|
+
tzinfo
|
|
6
|
+
|
|
7
|
+
GEM
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
|
+
specs:
|
|
10
|
+
byebug (9.1.0)
|
|
11
|
+
concurrent-ruby (1.1.10)
|
|
12
|
+
diff-lcs (1.5.0)
|
|
13
|
+
rake (13.0.6)
|
|
14
|
+
rspec (3.11.0)
|
|
15
|
+
rspec-core (~> 3.11.0)
|
|
16
|
+
rspec-expectations (~> 3.11.0)
|
|
17
|
+
rspec-mocks (~> 3.11.0)
|
|
18
|
+
rspec-core (3.11.0)
|
|
19
|
+
rspec-support (~> 3.11.0)
|
|
20
|
+
rspec-expectations (3.11.0)
|
|
21
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
22
|
+
rspec-support (~> 3.11.0)
|
|
23
|
+
rspec-mocks (3.11.0)
|
|
24
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
25
|
+
rspec-support (~> 3.11.0)
|
|
26
|
+
rspec-support (3.11.0)
|
|
27
|
+
tzinfo (2.0.4)
|
|
28
|
+
concurrent-ruby (~> 1.0)
|
|
29
|
+
|
|
30
|
+
PLATFORMS
|
|
31
|
+
ruby
|
|
32
|
+
|
|
33
|
+
DEPENDENCIES
|
|
34
|
+
bundler (~> 2.3)
|
|
35
|
+
byebug (~> 9.1)
|
|
36
|
+
rake (~> 13.0)
|
|
37
|
+
rspec (~> 3.7)
|
|
38
|
+
zmanim!
|
|
39
|
+
|
|
40
|
+
BUNDLED WITH
|
|
41
|
+
2.3.10
|
|
@@ -46,7 +46,7 @@ module Zmanim::HebrewCalendar
|
|
|
46
46
|
transliterated: Zmanim::HebrewCalendar::JewishCalendar::SIGNIFICANT_DAYS.each_with_object({}){|d, h|
|
|
47
47
|
h[d] = titleize(d)
|
|
48
48
|
}.merge(tzom_gedalyah: 'Fast of Gedalyah', tenth_of_teves: 'Tenth of Teves', tu_beshvat: "Tu B'Shvat",
|
|
49
|
-
taanis_esther: 'Fast of Esther', seventeen_of_tammuz: 'Seventeenth of Tammuz',
|
|
49
|
+
taanis_esther: 'Fast of Esther', lag_baomer: "Lag B'Omer", seventeen_of_tammuz: 'Seventeenth of Tammuz',
|
|
50
50
|
tisha_beav: "Tisha B'Av", tu_beav: "Tu B'Av", yom_hashoah: 'Yom HaShoah', yom_haatzmaut: "Yom Ha'atzmaut"),
|
|
51
51
|
hebrew: {
|
|
52
52
|
erev_rosh_hashana: 'ערב ראש השנה',
|
|
@@ -72,6 +72,7 @@ module Zmanim::HebrewCalendar
|
|
|
72
72
|
pesach: 'פסח',
|
|
73
73
|
chol_hamoed_pesach: 'חול המועד פסח',
|
|
74
74
|
pesach_sheni: 'פסח שני',
|
|
75
|
+
lag_baomer: 'ל״ג בעומר',
|
|
75
76
|
erev_shavuos: 'ערב שבועות',
|
|
76
77
|
shavuos: 'שבועות',
|
|
77
78
|
seventeen_of_tammuz: 'שבעה עשר בתמוז',
|
|
@@ -179,18 +180,15 @@ module Zmanim::HebrewCalendar
|
|
|
179
180
|
if hebrew_format
|
|
180
181
|
format_hebrew_number(number) + ' ' + hebrew_omer_prefix + 'עומר'
|
|
181
182
|
else
|
|
182
|
-
number == 33 ?
|
|
183
|
+
number == 33 ? "Lag B'Omer" : "Omer #{number}"
|
|
183
184
|
end
|
|
184
185
|
end
|
|
185
186
|
|
|
186
187
|
def format_kviah(year)
|
|
187
188
|
date = year.is_a?(Numeric) ? Zmanim::HebrewCalendar::JewishDate.new(year, 7, 1) : year
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
date.jewish_month = 1
|
|
192
|
-
pesach_day = date.day_of_week
|
|
193
|
-
"#{format_hebrew_number(rosh_hashana_day)}#{kviah_glyph}#{format_hebrew_number(pesach_day)}".delete(GERESH)
|
|
189
|
+
kviah_values = date.kviah
|
|
190
|
+
kviah_glyph = {chaseirim: 'ח', kesidran: 'כ', shelaimim: 'ש'}[kviah_values[:kviah]]
|
|
191
|
+
"#{format_hebrew_number(kviah_values[:rosh_hashana])}#{kviah_glyph}#{format_hebrew_number(kviah_values[:pesach])}".delete(GERESH)
|
|
194
192
|
end
|
|
195
193
|
|
|
196
194
|
def format_tefilah_additions(calendar, customs={walled_city: false, nusach: :ashkenaz})
|
|
@@ -8,7 +8,7 @@ module Zmanim::HebrewCalendar
|
|
|
8
8
|
erev_succos succos chol_hamoed_succos hoshana_rabbah shemini_atzeres simchas_torah
|
|
9
9
|
chanukah tenth_of_teves tu_beshvat
|
|
10
10
|
taanis_esther purim shushan_purim purim_katan shushan_purim_katan
|
|
11
|
-
erev_pesach pesach chol_hamoed_pesach pesach_sheni erev_shavuos shavuos
|
|
11
|
+
erev_pesach pesach chol_hamoed_pesach pesach_sheni lag_baomer erev_shavuos shavuos
|
|
12
12
|
seventeen_of_tammuz tisha_beav tu_beav
|
|
13
13
|
yom_hashoah yom_hazikaron yom_haatzmaut yom_yerushalayim)
|
|
14
14
|
|
|
@@ -30,6 +30,22 @@ module Zmanim::HebrewCalendar
|
|
|
30
30
|
send("#{jewish_month_name}_significant_day")
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
+
def assur_bemelacha?
|
|
34
|
+
day_of_week == 7 || yom_tov_assur_bemelacha?
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def tomorrow_assur_bemelacha?
|
|
38
|
+
day_of_week == 6 || erev_yom_tov? || erev_yom_tov_sheni?
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def candle_lighting?
|
|
42
|
+
tomorrow_assur_bemelacha?
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def delayed_candle_lighting?
|
|
46
|
+
day_of_week != 6 && candle_lighting? && assur_bemelacha?
|
|
47
|
+
end
|
|
48
|
+
|
|
33
49
|
def yom_tov?
|
|
34
50
|
sd = significant_day
|
|
35
51
|
sd && !sd.to_s.start_with?('erev_') && (!taanis? || sd == :yom_kippur)
|
|
@@ -39,21 +55,40 @@ module Zmanim::HebrewCalendar
|
|
|
39
55
|
%i(pesach shavuos rosh_hashana yom_kippur succos shemini_atzeres simchas_torah).include?(significant_day)
|
|
40
56
|
end
|
|
41
57
|
|
|
42
|
-
def chol_hamoed?
|
|
43
|
-
sd = significant_day
|
|
44
|
-
sd && (sd.to_s.start_with?('chol_hamoed_') || sd == :hoshana_rabbah)
|
|
45
|
-
end
|
|
46
|
-
|
|
47
58
|
def erev_yom_tov?
|
|
48
59
|
return false unless sd = significant_day
|
|
49
60
|
sd.to_s.start_with?('erev_') || sd == :hoshana_rabbah ||
|
|
50
61
|
(sd == :chol_hamoed_pesach && jewish_day == 20)
|
|
51
62
|
end
|
|
52
63
|
|
|
64
|
+
def yom_tov_sheni?
|
|
65
|
+
(jewish_month == 7 && jewish_day == 2) ||
|
|
66
|
+
(!in_israel && ((jewish_month == 7 && [16, 23].include?(jewish_day)) ||
|
|
67
|
+
(jewish_month == 1 && [16, 22].include?(jewish_day)) ||
|
|
68
|
+
(jewish_month == 3 && jewish_day == 7)))
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def erev_yom_tov_sheni?
|
|
72
|
+
(jewish_month == 7 && jewish_day == 1) ||
|
|
73
|
+
(!in_israel && ((jewish_month == 7 && [15, 22].include?(jewish_day)) ||
|
|
74
|
+
(jewish_month == 1 && [15, 21].include?(jewish_day)) ||
|
|
75
|
+
(jewish_month == 3 && jewish_day == 6)))
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def chol_hamoed?
|
|
79
|
+
sd = significant_day
|
|
80
|
+
sd && (sd.to_s.start_with?('chol_hamoed_') || sd == :hoshana_rabbah)
|
|
81
|
+
end
|
|
82
|
+
|
|
53
83
|
def taanis?
|
|
54
84
|
%i(seventeen_of_tammuz tisha_beav tzom_gedalyah yom_kippur tenth_of_teves taanis_esther).include?(significant_day)
|
|
55
85
|
end
|
|
56
86
|
|
|
87
|
+
def taanis_bechorim?
|
|
88
|
+
(day_of_week != 7 && jewish_day == 14 && jewish_month == 1) || # normally 14th of nissan,
|
|
89
|
+
(day_of_week == 5 && jewish_day == 12 && jewish_month == 1) # when that falls on shabbos, moved to previous Thursday
|
|
90
|
+
end
|
|
91
|
+
|
|
57
92
|
def rosh_chodesh?
|
|
58
93
|
jewish_day == 30 || (jewish_day == 1 && jewish_month != 7)
|
|
59
94
|
end
|
|
@@ -123,6 +158,10 @@ module Zmanim::HebrewCalendar
|
|
|
123
158
|
molad_as_datetime + 15
|
|
124
159
|
end
|
|
125
160
|
|
|
161
|
+
def end_of_week
|
|
162
|
+
self + (7 - day_of_week)
|
|
163
|
+
end
|
|
164
|
+
|
|
126
165
|
def daf_yomi_bavli
|
|
127
166
|
Zmanim::Limudim::Calculators::DafYomiBavli.new.limud(self)
|
|
128
167
|
end
|
|
@@ -131,8 +170,14 @@ module Zmanim::HebrewCalendar
|
|
|
131
170
|
Zmanim::Limudim::Calculators::DafYomiYerushalmi.new.limud(self)
|
|
132
171
|
end
|
|
133
172
|
|
|
134
|
-
def
|
|
135
|
-
Zmanim::Limudim::Calculators::
|
|
173
|
+
def daf_hashavua_bavli
|
|
174
|
+
Zmanim::Limudim::Calculators::DafHashavuaBavli.new.limud(self)
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
def parshas_hashavua(current_week_only: false)
|
|
178
|
+
limud = Zmanim::Limudim::Calculators::Parsha.new(in_israel: in_israel).limud(self)
|
|
179
|
+
limud.clear! if current_week_only && limud.interval.end_date > end_of_week
|
|
180
|
+
limud
|
|
136
181
|
end
|
|
137
182
|
|
|
138
183
|
def tehillim_portion
|
|
@@ -191,6 +236,144 @@ module Zmanim::HebrewCalendar
|
|
|
191
236
|
end
|
|
192
237
|
end
|
|
193
238
|
|
|
239
|
+
def pesach(upcoming: nil, year: nil)
|
|
240
|
+
find_annual_event(upcoming, year) do |y|
|
|
241
|
+
JewishCalendar.new(y, 1, 15)
|
|
242
|
+
end
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
def pesach_sheni(upcoming: nil, year: nil)
|
|
246
|
+
find_annual_event(upcoming, year) do |y|
|
|
247
|
+
JewishCalendar.new(y, 2, 14)
|
|
248
|
+
end
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
def lag_baomer(upcoming: nil, year: nil)
|
|
252
|
+
find_annual_event(upcoming, year) do |y|
|
|
253
|
+
JewishCalendar.new(y, 2, 18)
|
|
254
|
+
end
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
def shavuos(upcoming: nil, year: nil)
|
|
258
|
+
find_annual_event(upcoming, year) do |y|
|
|
259
|
+
JewishCalendar.new(y, 3, 6)
|
|
260
|
+
end
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
def seventeen_of_tammuz(upcoming: nil, year: nil)
|
|
264
|
+
find_annual_event(upcoming, year) do |y|
|
|
265
|
+
date = JewishCalendar.new(y, 4, 17)
|
|
266
|
+
date.forward! if date.day_of_week == 7
|
|
267
|
+
date
|
|
268
|
+
end
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
def tisha_beav(upcoming: nil, year: nil)
|
|
272
|
+
find_annual_event(upcoming, year) do |y|
|
|
273
|
+
date = JewishCalendar.new(y, 5, 9)
|
|
274
|
+
date.forward! if date.day_of_week == 7
|
|
275
|
+
date
|
|
276
|
+
end
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
def tu_beav(upcoming: nil, year: nil)
|
|
280
|
+
find_annual_event(upcoming, year) do |y|
|
|
281
|
+
JewishCalendar.new(y, 5, 15)
|
|
282
|
+
end
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
def rosh_hashana(upcoming: nil, year: nil)
|
|
286
|
+
find_annual_event(upcoming, year) do |y|
|
|
287
|
+
JewishCalendar.new(y, 7, 1)
|
|
288
|
+
end
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
def tzom_gedalyah(upcoming: nil, year: nil)
|
|
292
|
+
find_annual_event(upcoming, year) do |y|
|
|
293
|
+
date = JewishCalendar.new(y, 7, 3)
|
|
294
|
+
date.forward! if date.day_of_week == 7
|
|
295
|
+
date
|
|
296
|
+
end
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
def yom_kippur(upcoming: nil, year: nil)
|
|
300
|
+
find_annual_event(upcoming, year) do |y|
|
|
301
|
+
JewishCalendar.new(y, 7, 10)
|
|
302
|
+
end
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
def succos(upcoming: nil, year: nil)
|
|
306
|
+
find_annual_event(upcoming, year) do |y|
|
|
307
|
+
JewishCalendar.new(y, 7, 15)
|
|
308
|
+
end
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
def chanukah(upcoming: nil, year: nil)
|
|
312
|
+
find_annual_event(upcoming, year) do |y|
|
|
313
|
+
JewishCalendar.new(y, 9, 25)
|
|
314
|
+
end
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
def tenth_of_teves(upcoming: nil, year: nil)
|
|
318
|
+
find_annual_event(upcoming, year) do |y|
|
|
319
|
+
JewishCalendar.new(y, 10, 10)
|
|
320
|
+
end
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
def tu_beshvat(upcoming: nil, year: nil)
|
|
324
|
+
find_annual_event(upcoming, year) do |y|
|
|
325
|
+
JewishCalendar.new(y, 11, 15)
|
|
326
|
+
end
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
def purim(upcoming: nil, year: nil)
|
|
330
|
+
find_annual_event(upcoming, year) do |y|
|
|
331
|
+
JewishCalendar.new(y, months_in_jewish_year(y), 14)
|
|
332
|
+
end
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
def rosh_chodesh(upcoming: nil, month: nil, year: nil)
|
|
336
|
+
find_monthly_event(upcoming, month, year) do |m, y|
|
|
337
|
+
m = 8 if m == 7
|
|
338
|
+
prev = m - 1
|
|
339
|
+
prev = months_in_jewish_year(y) if prev < 1
|
|
340
|
+
if days_in_jewish_month(prev,y) == 30
|
|
341
|
+
JewishCalendar.new(y, prev, 30)
|
|
342
|
+
else
|
|
343
|
+
JewishCalendar.new(y, m, 1)
|
|
344
|
+
end
|
|
345
|
+
end
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
def shabbos_mevorchim(upcoming: nil, month: nil, year: nil)
|
|
349
|
+
find_monthly_event(upcoming, month, year) do |m, y|
|
|
350
|
+
m = 8 if m == 7
|
|
351
|
+
prev = m - 1
|
|
352
|
+
prev = months_in_jewish_year(y) if prev < 1
|
|
353
|
+
mevorchim_start = JewishCalendar.new(y,prev,23)
|
|
354
|
+
mevorchim_start + (7 - mevorchim_start.day_of_week)
|
|
355
|
+
end
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
def vesein_tal_umatar_start(upcoming: nil, year: nil)
|
|
359
|
+
find_annual_event(upcoming, year) do |y|
|
|
360
|
+
start_date =
|
|
361
|
+
if in_israel
|
|
362
|
+
JewishCalendar.new(y, 8, 7)
|
|
363
|
+
else
|
|
364
|
+
JewishCalendar.new(y, 7, 1) + (47 - tekufas_tishrei_elapsed_days(1, year: y))
|
|
365
|
+
end
|
|
366
|
+
start_date.forward! if start_date.day_of_week == 7
|
|
367
|
+
start_date
|
|
368
|
+
end
|
|
369
|
+
end
|
|
370
|
+
|
|
371
|
+
def shabbos_mevorchim?
|
|
372
|
+
day_of_week == 7 &&
|
|
373
|
+
jewish_month != 6 &&
|
|
374
|
+
(23..29).include?(jewish_day)
|
|
375
|
+
end
|
|
376
|
+
|
|
194
377
|
def mashiv_haruach_starts?
|
|
195
378
|
jewish_month == 7 && jewish_day == 22
|
|
196
379
|
end
|
|
@@ -209,18 +392,33 @@ module Zmanim::HebrewCalendar
|
|
|
209
392
|
!mashiv_haruach? || mashiv_haruach_starts? || mashiv_haruach_ends?
|
|
210
393
|
end
|
|
211
394
|
|
|
212
|
-
#
|
|
213
|
-
#
|
|
395
|
+
# Because the jewish date does not auto-increment in the evening,
|
|
396
|
+
# we use the daytime transition (e.g. December 5/6 for 20th/21st century) as the start date
|
|
214
397
|
# and rely on the user to increment the jewish date after nightfall.
|
|
215
|
-
# Note that according to many, the date for Vesein Tal Umatar is tied to the Julian calendar and has historically
|
|
216
|
-
# moved over time as the deviance from the Gregorian calendar increases. The date of December 4/5 is to be used
|
|
217
|
-
# for the 20th and 21st century.
|
|
218
398
|
def vesein_tal_umatar?
|
|
219
399
|
return false if day_of_week == 7 || yom_tov_assur_bemelacha?
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
400
|
+
return true if jewish_month == 1 && jewish_day < 15
|
|
401
|
+
return false if jewish_month < 8
|
|
402
|
+
if in_israel
|
|
403
|
+
jewish_month > 8 || (jewish_month == 8 && jewish_day >= 7)
|
|
404
|
+
else
|
|
405
|
+
tekufas_tishrei_elapsed_days >= 47
|
|
406
|
+
end
|
|
407
|
+
end
|
|
408
|
+
|
|
409
|
+
def vesein_tal_umatar_starts?
|
|
410
|
+
if in_israel
|
|
411
|
+
# 7 Cheshvan, or 8 Cheshvan if 7 is Shabbos
|
|
412
|
+
return false unless jewish_month == 8
|
|
413
|
+
(day_of_week != 7 && jewish_day == 7) || (day_of_week == 1 && jewish_day == 8)
|
|
414
|
+
else
|
|
415
|
+
elapsed_days = tekufas_tishrei_elapsed_days
|
|
416
|
+
(day_of_week != 7 && elapsed_days == 47) || (day_of_week == 1 && elapsed_days == 48)
|
|
417
|
+
end
|
|
418
|
+
end
|
|
419
|
+
|
|
420
|
+
def vesein_tal_umatar_starts_tonight?
|
|
421
|
+
succ.vesein_tal_umatar_starts?
|
|
224
422
|
end
|
|
225
423
|
|
|
226
424
|
def vesein_beracha?
|
|
@@ -261,6 +459,8 @@ module Zmanim::HebrewCalendar
|
|
|
261
459
|
def iyar_significant_day
|
|
262
460
|
if jewish_day == 14
|
|
263
461
|
:pesach_sheni
|
|
462
|
+
elsif jewish_day == 18
|
|
463
|
+
:lag_baomer
|
|
264
464
|
elsif use_modern_holidays
|
|
265
465
|
# Note that this logic follows the current rules, which were last revised in 5764.
|
|
266
466
|
# The calculations for years prior may not reflect the actual dates observed at that time.
|
|
@@ -390,5 +590,54 @@ module Zmanim::HebrewCalendar
|
|
|
390
590
|
:shushan_purim
|
|
391
591
|
end
|
|
392
592
|
end
|
|
593
|
+
|
|
594
|
+
def tekufas_tishrei_elapsed_days(day_number=day_number_of_jewish_year, year: jewish_year)
|
|
595
|
+
days = jewish_calendar_elapsed_days(year) + (day_number-1) + 0.5
|
|
596
|
+
solar = (year - 1) * 365.25
|
|
597
|
+
(days - solar).floor.to_i
|
|
598
|
+
end
|
|
599
|
+
|
|
600
|
+
# Finds the date for an annual event whose rules are provided to the method as a block
|
|
601
|
+
# Supports boolean `upcoming` or a given integer jewish `year`.
|
|
602
|
+
# If both are nil, defaults to current jewish year.
|
|
603
|
+
# `upcoming` finds the current or next occurrence of this event
|
|
604
|
+
def find_annual_event(upcoming, year)
|
|
605
|
+
if upcoming && year
|
|
606
|
+
raise "'upcoming' and 'year' options cannot be used together"
|
|
607
|
+
end
|
|
608
|
+
|
|
609
|
+
upcoming = false if upcoming.nil? # 'upcoming' only when explicitly passed
|
|
610
|
+
year = jewish_year if year.nil?
|
|
611
|
+
|
|
612
|
+
current = yield(year)
|
|
613
|
+
upcoming && current < self ? yield(year+1) : current
|
|
614
|
+
end
|
|
615
|
+
|
|
616
|
+
# Finds the date for a monthly event whose rules are provided to the method as a block
|
|
617
|
+
# Supports boolean `upcoming` or a given integer jewish `year` and `month`.
|
|
618
|
+
# If all are nil, defaults to current jewish month and year.
|
|
619
|
+
# `upcoming` finds the current or next occurrence of this event
|
|
620
|
+
# If only month is provided, defaults to current jewish year.
|
|
621
|
+
# If only year is provided, defaults to current jewish month.
|
|
622
|
+
def find_monthly_event(upcoming, month, year)
|
|
623
|
+
if upcoming && (year || month)
|
|
624
|
+
raise "'upcoming' option cannot be used together with 'year' or 'month'"
|
|
625
|
+
end
|
|
626
|
+
|
|
627
|
+
upcoming = false if upcoming.nil? # 'upcoming' only when explicitly passed
|
|
628
|
+
year ||= jewish_year
|
|
629
|
+
month ||= jewish_month
|
|
630
|
+
|
|
631
|
+
current = yield(month, year)
|
|
632
|
+
if upcoming && current < self
|
|
633
|
+
month += 1
|
|
634
|
+
month = 1 if month > months_in_jewish_year(year)
|
|
635
|
+
year += 1 if month == 7
|
|
636
|
+
yield(month, year)
|
|
637
|
+
else
|
|
638
|
+
current
|
|
639
|
+
end
|
|
640
|
+
end
|
|
641
|
+
|
|
393
642
|
end
|
|
394
643
|
end
|
|
@@ -157,6 +157,40 @@ module Zmanim::HebrewCalendar
|
|
|
157
157
|
end
|
|
158
158
|
end
|
|
159
159
|
|
|
160
|
+
def succ
|
|
161
|
+
self + 1
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
def step(limit, step=1, &block)
|
|
165
|
+
if step < 0
|
|
166
|
+
downto(limit, -step, &block)
|
|
167
|
+
else
|
|
168
|
+
upto(limit, step, &block)
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
def downto(limit, step=1)
|
|
173
|
+
raise ArgumentError, 'step argument must be greater than 0' if step <= 0
|
|
174
|
+
return to_enum(__method__, limit, step) unless block_given?
|
|
175
|
+
c = self
|
|
176
|
+
while c >= limit
|
|
177
|
+
yield c
|
|
178
|
+
c -= step
|
|
179
|
+
end
|
|
180
|
+
self
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
def upto(limit, step=1)
|
|
184
|
+
raise ArgumentError, 'step argument must be greater than 0' if step <= 0
|
|
185
|
+
return to_enum(__method__, limit, step) unless block_given?
|
|
186
|
+
c = self
|
|
187
|
+
while c <= limit
|
|
188
|
+
yield c
|
|
189
|
+
c += step
|
|
190
|
+
end
|
|
191
|
+
self
|
|
192
|
+
end
|
|
193
|
+
|
|
160
194
|
def gregorian_year=(year)
|
|
161
195
|
set_gregorian_date(year, gregorian_month, gregorian_day)
|
|
162
196
|
end
|
|
@@ -275,6 +309,17 @@ module Zmanim::HebrewCalendar
|
|
|
275
309
|
CHESHVAN_KISLEV_KEVIAH[(days_in_jewish_year(year) % 10) - 3]
|
|
276
310
|
end
|
|
277
311
|
|
|
312
|
+
def kviah(year=jewish_year)
|
|
313
|
+
date = year.is_a?(Numeric) ? Zmanim::HebrewCalendar::JewishDate.new(year, 7, 1) : year
|
|
314
|
+
kviah = date.cheshvan_kislev_kviah
|
|
315
|
+
rosh_hashana_day = date.day_of_week
|
|
316
|
+
date.jewish_month = 1
|
|
317
|
+
pesach_day = date.day_of_week
|
|
318
|
+
{rosh_hashana: rosh_hashana_day,
|
|
319
|
+
kviah: kviah,
|
|
320
|
+
pesach: pesach_day}
|
|
321
|
+
end
|
|
322
|
+
|
|
278
323
|
# Returns a new JewishDate as the molad for given month
|
|
279
324
|
def molad(month=jewish_month, year=jewish_year)
|
|
280
325
|
self.class.from_molad(chalakim_since_molad_tohu(year, month))
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require 'zmanim/limudim/calculators/daf_yomi_bavli'
|
|
2
|
+
|
|
3
|
+
module Zmanim::Limudim::Calculators
|
|
4
|
+
class DafHashavuaBavli < DafYomiBavli
|
|
5
|
+
def initial_cycle_date
|
|
6
|
+
jewish_date(Date.parse('2005-03-02'))
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def cycle_end_calculation
|
|
10
|
+
->(start_date, iteration){ start_date + ((2711*7) - start_date.day_of_week) } # 2711 pages except first week * 7 days
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def interval_end_calculation
|
|
14
|
+
->(cycle, start_date){ start_date + (7 - start_date.day_of_week) }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def cycle_units_calculation
|
|
18
|
+
->(cycle){ default_units }
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
|
|
@@ -40,7 +40,7 @@ module Zmanim::Limudim::Calculators
|
|
|
40
40
|
meilah: [4,9,8,6,5,6], tamid: [4,5,9,3,6,4,3], midos: [9,6,8,7,4], kinnim: [4,5,6],
|
|
41
41
|
keilim: [9,8,8,4,11,4,6,11,8,8,9,8,8,8,6,8,17,9,10,7,3,10,5,17,9,9,12,10,8,4], ohalos: [8,7,7,3,7,7,6,6,16,7,9,8,6,7,10,5,5,10],
|
|
42
42
|
negaim: [6,5,8,11,5,8,5,10,3,10,12,7,12,13], parah: [4,5,11,4,9,5,12,11,9,6,9,11], taharos: [9,8,8,13,9,10,9,9,9,8],
|
|
43
|
-
mikvaos: [8,10,4,5,6,11,7,5,7,8], niddah: [7,7,7,7,9,14,5,4,11,8],
|
|
43
|
+
mikvaos: [8,10,4,5,6,11,7,5,7,8], niddah: [7,7,7,7,9,14,5,4,11,8], machshirin: [6,11,8,10,11,8], zavim: [6,4,3,7,12],
|
|
44
44
|
tevul_yom: [5,8,6,7], yadayim: [5,4,5,8], uktzin: [6,10,12]
|
|
45
45
|
}.map{|k, v| [k, Hash[v.map.with_index{|m, p| [p+1, m]}]]}]
|
|
46
46
|
end
|
|
@@ -47,40 +47,40 @@ module Zmanim::Limudim::Calculators
|
|
|
47
47
|
|
|
48
48
|
def cycle_units_calculation
|
|
49
49
|
->(cycle) do
|
|
50
|
-
|
|
50
|
+
kviah_values = cycle.start_date.kviah.values
|
|
51
51
|
modifications = in_israel ?
|
|
52
52
|
{
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}[
|
|
53
|
+
[2,:chaseirim,5] => [%i(matos masei), %i(nitzavim vayeilech)],
|
|
54
|
+
[2,:shelaimim,7] => [],
|
|
55
|
+
[3,:kesidran,7] => [],
|
|
56
|
+
[5,:chaseirim,1] => [],
|
|
57
|
+
[5,:shelaimim,3] => [%i(nitzavim vayeilech)],
|
|
58
|
+
[7,:chaseirim,3] => [%i(matos masei), %i(nitzavim vayeilech)],
|
|
59
|
+
[7,:shelaimim,5] => [%i(matos masei), %i(nitzavim vayeilech)],
|
|
60
|
+
[2,:chaseirim,3] => [%i(vayakheil pikudei), %i(tazria metzora), %i(acharei kedoshim), %i(behar bechukosai), %i(matos masei), %i(nitzavim vayeilech)],
|
|
61
|
+
[2,:shelaimim,5] => [%i(vayakheil pikudei), %i(tazria metzora), %i(acharei kedoshim), %i(behar bechukosai), %i(matos masei), %i(nitzavim vayeilech)],
|
|
62
|
+
[3,:kesidran,5] => [%i(vayakheil pikudei), %i(tazria metzora), %i(acharei kedoshim), %i(behar bechukosai), %i(matos masei), %i(nitzavim vayeilech)],
|
|
63
|
+
[5,:kesidran,7] => [%i(vayakheil pikudei), %i(tazria metzora), %i(acharei kedoshim), %i(matos masei)],
|
|
64
|
+
[5,:shelaimim,1] => [%i(tazria metzora), %i(acharei kedoshim), %i(behar bechukosai), %i(matos masei)],
|
|
65
|
+
[7,:chaseirim,1] => [%i(vayakheil pikudei), %i(tazria metzora), %i(acharei kedoshim), %i(behar bechukosai), %i(matos masei)],
|
|
66
|
+
[7,:shelaimim,3] => [%i(vayakheil pikudei), %i(tazria metzora), %i(acharei kedoshim), %i(behar bechukosai), %i(matos masei)],
|
|
67
|
+
}[kviah_values] :
|
|
68
68
|
{
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}[
|
|
69
|
+
[2,:chaseirim,5] => [%i(chukas balak), %i(matos masei), %i(nitzavim vayeilech)],
|
|
70
|
+
[2,:shelaimim,7] => [%i(matos masei)],
|
|
71
|
+
[3,:kesidran,7] => [%i(matos masei)],
|
|
72
|
+
[5,:chaseirim,1] => [],
|
|
73
|
+
[5,:shelaimim,3] => [%i(nitzavim vayeilech)],
|
|
74
|
+
[7,:chaseirim,3] => [%i(matos masei), %i(nitzavim vayeilech)],
|
|
75
|
+
[7,:shelaimim,5] => [%i(chukas balak), %i(matos masei), %i(nitzavim vayeilech)],
|
|
76
|
+
[2,:chaseirim,3] => [%i(vayakheil pikudei), %i(tazria metzora), %i(acharei kedoshim), %i(behar bechukosai), %i(matos masei), %i(nitzavim vayeilech)],
|
|
77
|
+
[2,:shelaimim,5] => [%i(vayakheil pikudei), %i(tazria metzora), %i(acharei kedoshim), %i(behar bechukosai), %i(chukas balak), %i(matos masei), %i(nitzavim vayeilech)],
|
|
78
|
+
[3,:kesidran,5] => [%i(vayakheil pikudei), %i(tazria metzora), %i(acharei kedoshim), %i(behar bechukosai), %i(chukas balak), %i(matos masei), %i(nitzavim vayeilech)],
|
|
79
|
+
[5,:kesidran,7] => [%i(vayakheil pikudei), %i(tazria metzora), %i(acharei kedoshim), %i(behar bechukosai), %i(matos masei)],
|
|
80
|
+
[5,:shelaimim,1] => [%i(tazria metzora), %i(acharei kedoshim), %i(behar bechukosai), %i(matos masei)],
|
|
81
|
+
[7,:chaseirim,1] => [%i(vayakheil pikudei), %i(tazria metzora), %i(acharei kedoshim), %i(behar bechukosai), %i(matos masei)],
|
|
82
|
+
[7,:shelaimim,3] => [%i(vayakheil pikudei), %i(tazria metzora), %i(acharei kedoshim), %i(behar bechukosai), %i(matos masei), %i(nitzavim vayeilech)],
|
|
83
|
+
}[kviah_values]
|
|
84
84
|
modifications.inject(default_units) do |transitioned_units, parsha_pair|
|
|
85
85
|
index = transitioned_units.index(parsha_pair.first)
|
|
86
86
|
transitioned_units[0...index] + [parsha_pair] + transitioned_units[(index + 2)..-1]
|
data/lib/zmanim/limudim/cycle.rb
CHANGED
|
@@ -32,9 +32,5 @@ module Zmanim::Limudim
|
|
|
32
32
|
new_end_date = cycle_end_calculation.(new_start_date, new_iteration)
|
|
33
33
|
Cycle.new(new_start_date, new_end_date, new_iteration)
|
|
34
34
|
end
|
|
35
|
-
|
|
36
|
-
def first_interval(interval_end_calculation)
|
|
37
|
-
Interval.first_for_cycle(self, interval_end_calculation)
|
|
38
|
-
end
|
|
39
35
|
end
|
|
40
36
|
end
|
data/lib/zmanim/limudim/limud.rb
CHANGED
|
@@ -7,7 +7,7 @@ module Zmanim::Limudim
|
|
|
7
7
|
cycle = find_cycle(jewish_date)
|
|
8
8
|
return nil unless cycle && cycle.end_date >= date
|
|
9
9
|
units = cycle_units_calculation.(cycle)
|
|
10
|
-
interval =
|
|
10
|
+
interval = Interval.first_for_cycle(cycle, interval_end_calculation)
|
|
11
11
|
while !jewish_date.between?(interval.start_date, interval.end_date) do
|
|
12
12
|
interval = if skip_interval?(interval)
|
|
13
13
|
interval.skip(interval_end_calculation)
|
|
@@ -124,7 +124,7 @@ module Zmanim::Limudim
|
|
|
124
124
|
taharos: 'טהרות',
|
|
125
125
|
mikvaos: 'מקואות',
|
|
126
126
|
niddah: 'נדה',
|
|
127
|
-
|
|
127
|
+
machshirin: 'מכשירין',
|
|
128
128
|
zavim: 'זבים',
|
|
129
129
|
tevul_yom: 'טבול יום',
|
|
130
130
|
yadayim: 'ידים',
|
|
@@ -138,6 +138,7 @@ module Zmanim::Limudim
|
|
|
138
138
|
end
|
|
139
139
|
|
|
140
140
|
def format_parsha(limud)
|
|
141
|
+
return '' unless limud && limud.unit
|
|
141
142
|
prefix = hebrew_format ? 'פרשת ' : 'Parshas '
|
|
142
143
|
prefix + limud.unit.render do |parsha|
|
|
143
144
|
hebrew_format ? PARSHIYOS[parsha] : titleize(parsha)
|
data/lib/zmanim/version.rb
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
require_relative 'astronomical_calendar'
|
|
2
|
+
require_relative 'hebrew_calendar/jewish_calendar'
|
|
2
3
|
|
|
3
4
|
module Zmanim
|
|
4
5
|
class ZmanimCalendar < AstronomicalCalendar
|
|
5
6
|
attr_accessor :candle_lighting_offset
|
|
7
|
+
attr_writer :use_elevation
|
|
6
8
|
|
|
7
9
|
ZENITH_16_POINT_1 = GEOMETRIC_ZENITH + 16.1
|
|
8
10
|
ZENITH_8_POINT_5 = GEOMETRIC_ZENITH + 8.5
|
|
@@ -10,11 +12,31 @@ module Zmanim
|
|
|
10
12
|
def initialize(opts={})
|
|
11
13
|
super
|
|
12
14
|
@candle_lighting_offset = opts[:candle_lighting_offset] || 18
|
|
15
|
+
@use_elevation = false
|
|
13
16
|
end
|
|
14
17
|
|
|
18
|
+
def use_elevation?
|
|
19
|
+
!!@use_elevation
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def elevation_adjusted_sunrise
|
|
23
|
+
use_elevation? ? sunrise : sea_level_sunrise
|
|
24
|
+
end
|
|
25
|
+
alias_method :hanetz, :elevation_adjusted_sunrise
|
|
26
|
+
|
|
27
|
+
def elevation_adjusted_sunset
|
|
28
|
+
use_elevation? ? sunset : sea_level_sunset
|
|
29
|
+
end
|
|
30
|
+
alias_method :shkia, :elevation_adjusted_sunset
|
|
31
|
+
|
|
15
32
|
def tzais(opts={degrees: 8.5})
|
|
16
|
-
degrees, offset = extract_degrees_offset(opts)
|
|
17
|
-
|
|
33
|
+
degrees, offset, zmanis_offset = extract_degrees_offset(opts)
|
|
34
|
+
sunset_for_degrees = degrees == 0 ? elevation_adjusted_sunset : sunset_offset_by_degrees(GEOMETRIC_ZENITH + degrees)
|
|
35
|
+
if zmanis_offset != 0
|
|
36
|
+
offset_by_minutes_zmanis(sunset_for_degrees, zmanis_offset)
|
|
37
|
+
else
|
|
38
|
+
offset_by_minutes(sunset_for_degrees, offset)
|
|
39
|
+
end
|
|
18
40
|
end
|
|
19
41
|
|
|
20
42
|
def tzais_72
|
|
@@ -22,12 +44,17 @@ module Zmanim
|
|
|
22
44
|
end
|
|
23
45
|
|
|
24
46
|
def alos(opts={degrees: 16.1})
|
|
25
|
-
degrees, offset = extract_degrees_offset(opts)
|
|
26
|
-
|
|
47
|
+
degrees, offset, zmanis_offset = extract_degrees_offset(opts)
|
|
48
|
+
sunrise_for_degrees = degrees == 0 ? elevation_adjusted_sunrise : sunrise_offset_by_degrees(GEOMETRIC_ZENITH + degrees)
|
|
49
|
+
if zmanis_offset != 0
|
|
50
|
+
offset_by_minutes_zmanis(sunrise_for_degrees, -zmanis_offset)
|
|
51
|
+
else
|
|
52
|
+
offset_by_minutes(sunrise_for_degrees, -offset)
|
|
53
|
+
end
|
|
27
54
|
end
|
|
28
55
|
|
|
29
56
|
def alos_72
|
|
30
|
-
alos(offset:
|
|
57
|
+
alos(offset: 72)
|
|
31
58
|
end
|
|
32
59
|
|
|
33
60
|
alias_method :chatzos, :sun_transit
|
|
@@ -37,7 +64,7 @@ module Zmanim
|
|
|
37
64
|
end
|
|
38
65
|
|
|
39
66
|
def sof_zman_shma_gra
|
|
40
|
-
sof_zman_shma(
|
|
67
|
+
sof_zman_shma(elevation_adjusted_sunrise, elevation_adjusted_sunset)
|
|
41
68
|
end
|
|
42
69
|
|
|
43
70
|
def sof_zman_shma_mga
|
|
@@ -53,22 +80,22 @@ module Zmanim
|
|
|
53
80
|
end
|
|
54
81
|
|
|
55
82
|
def sof_zman_tfila_gra
|
|
56
|
-
sof_zman_tfila(
|
|
83
|
+
sof_zman_tfila(elevation_adjusted_sunrise, elevation_adjusted_sunset)
|
|
57
84
|
end
|
|
58
85
|
|
|
59
86
|
def sof_zman_tfila_mga
|
|
60
87
|
sof_zman_tfila(alos_72, tzais_72)
|
|
61
88
|
end
|
|
62
89
|
|
|
63
|
-
def mincha_gedola(day_start=
|
|
90
|
+
def mincha_gedola(day_start=elevation_adjusted_sunrise, day_end=elevation_adjusted_sunset)
|
|
64
91
|
shaos_into_day(day_start, day_end, 6.5)
|
|
65
92
|
end
|
|
66
93
|
|
|
67
|
-
def mincha_ketana(day_start=
|
|
94
|
+
def mincha_ketana(day_start=elevation_adjusted_sunrise, day_end=elevation_adjusted_sunset)
|
|
68
95
|
shaos_into_day(day_start, day_end, 9.5)
|
|
69
96
|
end
|
|
70
97
|
|
|
71
|
-
def plag_hamincha(day_start=
|
|
98
|
+
def plag_hamincha(day_start=elevation_adjusted_sunrise, day_end=elevation_adjusted_sunset)
|
|
72
99
|
shaos_into_day(day_start, day_end, 10.75)
|
|
73
100
|
end
|
|
74
101
|
|
|
@@ -77,7 +104,7 @@ module Zmanim
|
|
|
77
104
|
end
|
|
78
105
|
|
|
79
106
|
def shaah_zmanis_gra
|
|
80
|
-
shaah_zmanis(
|
|
107
|
+
shaah_zmanis(elevation_adjusted_sunrise, elevation_adjusted_sunset)
|
|
81
108
|
end
|
|
82
109
|
|
|
83
110
|
def shaah_zmanis_mga
|
|
@@ -86,7 +113,15 @@ module Zmanim
|
|
|
86
113
|
|
|
87
114
|
def shaah_zmanis_by_degrees_and_offset(degrees, offset)
|
|
88
115
|
opts = {degrees: degrees, offset: offset}
|
|
89
|
-
shaah_zmanis(alos(opts
|
|
116
|
+
shaah_zmanis(alos(opts), tzais(opts))
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def assur_bemelacha?(current_time, tzais: tzais(), in_israel: false)
|
|
120
|
+
tzais_time = tzais.is_a?(Hash) ? self.tzais(tzais) : tzais
|
|
121
|
+
jewish_calendar = HebrewCalendar::JewishCalendar.new(current_time.to_date)
|
|
122
|
+
jewish_calendar.in_israel = in_israel
|
|
123
|
+
(current_time.to_datetime <= tzais_time && jewish_calendar.assur_bemelacha?) ||
|
|
124
|
+
(current_time.to_datetime >= elevation_adjusted_sunset && jewish_calendar.tomorrow_assur_bemelacha?)
|
|
90
125
|
end
|
|
91
126
|
|
|
92
127
|
private
|
|
@@ -97,12 +132,18 @@ module Zmanim
|
|
|
97
132
|
end
|
|
98
133
|
|
|
99
134
|
def extract_degrees_offset(opts)
|
|
100
|
-
[opts[:degrees] || 0.0, opts[:offset] || 0]
|
|
135
|
+
[opts[:degrees] || 0.0, opts[:offset] || 0, opts[:zmanis_offset] || 0]
|
|
101
136
|
end
|
|
102
137
|
|
|
103
138
|
def offset_by_minutes(time, minutes)
|
|
104
139
|
return unless time
|
|
105
140
|
time + (minutes / (60 * 24).to_f)
|
|
106
141
|
end
|
|
142
|
+
|
|
143
|
+
def offset_by_minutes_zmanis(time, minutes)
|
|
144
|
+
return unless time
|
|
145
|
+
shaah_zmanis_skew = shaah_zmanis_gra / HOUR_MILLIS
|
|
146
|
+
time + (minutes * shaah_zmanis_skew / (60 * 24).to_f)
|
|
147
|
+
end
|
|
107
148
|
end
|
|
108
149
|
end
|
data/zmanim.gemspec
CHANGED
|
@@ -30,8 +30,8 @@ Gem::Specification.new do |spec|
|
|
|
30
30
|
spec.require_paths = ["lib"]
|
|
31
31
|
|
|
32
32
|
spec.add_runtime_dependency "tzinfo"
|
|
33
|
-
spec.add_development_dependency "bundler", "~>
|
|
34
|
-
spec.add_development_dependency "rake", "~>
|
|
33
|
+
spec.add_development_dependency "bundler", "~> 2.3"
|
|
34
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
|
35
35
|
spec.add_development_dependency "rspec", "~> 3.7"
|
|
36
36
|
spec.add_development_dependency "byebug", "~> 9.1"
|
|
37
37
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: zmanim
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Pinny Markowitz
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2022-03-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: tzinfo
|
|
@@ -30,28 +30,28 @@ dependencies:
|
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '
|
|
33
|
+
version: '2.3'
|
|
34
34
|
type: :development
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '
|
|
40
|
+
version: '2.3'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: rake
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
45
|
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
47
|
+
version: '13.0'
|
|
48
48
|
type: :development
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
54
|
+
version: '13.0'
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: rspec
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -92,6 +92,7 @@ files:
|
|
|
92
92
|
- ".rspec"
|
|
93
93
|
- CHANGELOG.md
|
|
94
94
|
- Gemfile
|
|
95
|
+
- Gemfile.lock
|
|
95
96
|
- LICENSE
|
|
96
97
|
- README.md
|
|
97
98
|
- Rakefile
|
|
@@ -105,6 +106,7 @@ files:
|
|
|
105
106
|
- lib/zmanim/limudim/anchor/day_of_month_anchor.rb
|
|
106
107
|
- lib/zmanim/limudim/anchor/day_of_week_anchor.rb
|
|
107
108
|
- lib/zmanim/limudim/anchor/day_of_year_anchor.rb
|
|
109
|
+
- lib/zmanim/limudim/calculators/daf_hashavua_bavli.rb
|
|
108
110
|
- lib/zmanim/limudim/calculators/daf_yomi_bavli.rb
|
|
109
111
|
- lib/zmanim/limudim/calculators/daf_yomi_yerushalmi.rb
|
|
110
112
|
- lib/zmanim/limudim/calculators/mishna_yomis.rb
|
|
@@ -132,7 +134,7 @@ homepage: https://github.com/pinnymz/ruby-zmanim
|
|
|
132
134
|
licenses: []
|
|
133
135
|
metadata:
|
|
134
136
|
allowed_push_host: https://rubygems.org
|
|
135
|
-
post_install_message:
|
|
137
|
+
post_install_message:
|
|
136
138
|
rdoc_options: []
|
|
137
139
|
require_paths:
|
|
138
140
|
- lib
|
|
@@ -147,9 +149,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
147
149
|
- !ruby/object:Gem::Version
|
|
148
150
|
version: '0'
|
|
149
151
|
requirements: []
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
signing_key:
|
|
152
|
+
rubygems_version: 3.1.4
|
|
153
|
+
signing_key:
|
|
153
154
|
specification_version: 4
|
|
154
155
|
summary: A Zmanim library for Ruby
|
|
155
156
|
test_files: []
|