Class: Zmanim::HebrewCalendar::JewishCalendar

Inherits:
JewishDate
  • Object
show all
Defined in:
lib/zmanim/hebrew_calendar/jewish_calendar.rb

Constant Summary collapse

SIGNIFICANT_DAYS =
%i(erev_rosh_hashana rosh_hashana tzom_gedalyah erev_yom_kippur yom_kippur
erev_succos succos chol_hamoed_succos hoshana_rabbah shemini_atzeres simchas_torah
chanukah tenth_of_teves tu_beshvat
taanis_esther purim shushan_purim purim_katan shushan_purim_katan
erev_pesach pesach chol_hamoed_pesach pesach_sheni lag_baomer erev_shavuos shavuos
seventeen_of_tammuz tisha_beav tu_beav
yom_hashoah yom_hazikaron yom_haatzmaut yom_yerushalayim)
SIGNIFICANT_TEFILOS =
%i(yaaleh_veyavo al_hanissim begin_mashiv_haruach end_mashiv_haruach mashiv_haruach begin_morid_hatal morid_hatal vesein_tal_umatar vesein_beracha atah_yatzarta borchi_nafshi)
SIGNIFICANT_SHABBOS =
%i(parshas_shekalim parshas_zachor parshas_parah parshas_hachodesh shabbos_hagadol shabbos_shuva)

Constants inherited from JewishDate

Zmanim::HebrewCalendar::JewishDate::CHALAKIM_MOLAD_TOHU, Zmanim::HebrewCalendar::JewishDate::CHALAKIM_PER_DAY, Zmanim::HebrewCalendar::JewishDate::CHALAKIM_PER_HOUR, Zmanim::HebrewCalendar::JewishDate::CHALAKIM_PER_MINUTE, Zmanim::HebrewCalendar::JewishDate::CHALAKIM_PER_MONTH, Zmanim::HebrewCalendar::JewishDate::CHESHVAN_KISLEV_KEVIAH, Zmanim::HebrewCalendar::JewishDate::JEWISH_EPOCH, Zmanim::HebrewCalendar::JewishDate::MONTHS, Zmanim::HebrewCalendar::JewishDate::RD

Instance Attribute Summary collapse

Attributes inherited from JewishDate

#day_of_week, #gregorian_date, #jewish_day, #jewish_month, #jewish_year, #molad_chalakim, #molad_hours, #molad_minutes

Instance Method Summary collapse

Methods inherited from JewishDate

#+, #-, #<=>, #back!, #cheshvan_kislev_kviah, #cheshvan_long?, #cheshvan_short?, #date=, #day_number_of_jewish_year, #days_in_gregorian_month, #days_in_gregorian_year, #days_in_jewish_month, #days_in_jewish_year, #downto, #forward!, from_date, from_jewish_date, from_molad, #gregorian_day, #gregorian_day=, #gregorian_leap_year?, #gregorian_month, #gregorian_month=, #gregorian_year, #gregorian_year=, #jewish_leap_year?, #jewish_month_from_name, #jewish_month_name, #kislev_long?, #kislev_short?, #kviah, #molad, #months_in_jewish_year, #reset_date!, #set_gregorian_date, #set_jewish_date, #sorted_days_in_jewish_year, #sorted_months_in_jewish_year, #step, #succ, #upto

Constructor Details

#initialize(*args) ⇒ JewishCalendar

Returns a new instance of JewishCalendar.



19
20
21
22
23
24
25
26
27
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 19

def initialize(*args)
  if args.count == 4
    super(*args[0..2])
  else
    super
  end
  @in_israel = !!args[3]
  @use_modern_holidays = false
end

Instance Attribute Details

#in_israelObject

Returns the value of attribute in_israel.



5
6
7
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 5

def in_israel
  @in_israel
end

#use_modern_holidaysObject

Returns the value of attribute use_modern_holidays.



5
6
7
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 5

def use_modern_holidays
  @use_modern_holidays
end

Instance Method Details

#al_hanissim?(walled_city = false) ⇒ Boolean

Returns:

  • (Boolean)


433
434
435
436
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 433

def al_hanissim?(walled_city=false)
  purim_day = walled_city ? :shushan_purim : :purim
  [:chanukah, purim_day].include?(significant_day)
end

#assur_bemelacha?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 33

def assur_bemelacha?
  day_of_week == 7 || yom_tov_assur_bemelacha?
end

#candle_lighting?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 41

def candle_lighting?
  tomorrow_assur_bemelacha?
end

#chanukah(upcoming: nil, year: nil) ⇒ Object



311
312
313
314
315
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 311

def chanukah(upcoming: nil, year: nil)
  find_annual_event(upcoming, year) do |y|
    JewishCalendar.new(y, 9, 25)
  end
end

#chanukah?Boolean

Returns:

  • (Boolean)


100
101
102
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 100

def chanukah?
  significant_day == :chanukah
end

#chol_hamoed?Boolean

Returns:

  • (Boolean)


78
79
80
81
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 78

def chol_hamoed?
  sd = significant_day
  sd && (sd.to_s.start_with?('chol_hamoed_') || sd == :hoshana_rabbah)
end

#daf_hashavua_bavliObject



173
174
175
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 173

def daf_hashavua_bavli
  Zmanim::Limudim::Calculators::DafHashavuaBavli.new.limud(self)
end

#daf_yomi_bavliObject



165
166
167
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 165

def daf_yomi_bavli
  Zmanim::Limudim::Calculators::DafYomiBavli.new.limud(self)
end

#daf_yomi_yerushalmiObject



169
170
171
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 169

def daf_yomi_yerushalmi
  Zmanim::Limudim::Calculators::DafYomiYerushalmi.new.limud(self)
end

#day_of_chanukahObject



104
105
106
107
108
109
110
111
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 104

def day_of_chanukah
  return unless chanukah?
  if jewish_month_name == :kislev
    jewish_day - 24
  else
    (kislev_short? ? 5 : 6) + jewish_day
  end
end

#day_of_omerObject



113
114
115
116
117
118
119
120
121
122
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 113

def day_of_omer
  case jewish_month_name
    when :nissan
      return (jewish_day - 15 if jewish_day > 15)
    when :iyar
      return jewish_day + 15
    when :sivan
      return (jewish_day + 44) if jewish_day < 6
  end
end

#delayed_candle_lighting?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 45

def delayed_candle_lighting?
  day_of_week != 6 && candle_lighting? && assur_bemelacha?
end

#end_of_weekObject



161
162
163
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 161

def end_of_week
  self + (7 - day_of_week)
end

#erev_rosh_chodesh?Boolean

Returns:

  • (Boolean)


96
97
98
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 96

def erev_rosh_chodesh?
  jewish_day == 29 && jewish_month != 6
end

#erev_yom_tov?Boolean

Returns:

  • (Boolean)


58
59
60
61
62
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 58

def erev_yom_tov?
  return false unless sd = significant_day
  sd.to_s.start_with?('erev_') || sd == :hoshana_rabbah ||
      (sd == :chol_hamoed_pesach && jewish_day == 20)
end

#erev_yom_tov_sheni?Boolean

Returns:

  • (Boolean)


71
72
73
74
75
76
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 71

def erev_yom_tov_sheni?
  (jewish_month == 7 && jewish_day == 1) ||
      (!in_israel && ((jewish_month == 7 && [15, 22].include?(jewish_day)) ||
                      (jewish_month == 1 && [15, 21].include?(jewish_day)) ||
                      (jewish_month == 3 && jewish_day == 6)))
end

#lag_baomer(upcoming: nil, year: nil) ⇒ Object



251
252
253
254
255
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 251

def lag_baomer(upcoming: nil, year: nil)
  find_annual_event(upcoming, year) do |y|
    JewishCalendar.new(y, 2, 18)
  end
end

#mashiv_haruach?Boolean

Returns:

  • (Boolean)


385
386
387
388
389
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 385

def mashiv_haruach?
  start_date = JewishDate.new(jewish_year, 7, 22)
  end_date = JewishDate.new(jewish_year, 1, 15)
  self.between?(start_date, end_date)
end

#mashiv_haruach_ends?Boolean

Returns:

  • (Boolean)


381
382
383
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 381

def mashiv_haruach_ends?
  jewish_month == 1 && jewish_day == 15
end

#mashiv_haruach_starts?Boolean

Returns:

  • (Boolean)


377
378
379
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 377

def mashiv_haruach_starts?
  jewish_month == 7 && jewish_day == 22
end

#mishna_yomisObject



187
188
189
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 187

def mishna_yomis
  Zmanim::Limudim::Calculators::MishnaYomis.new.limud(self)
end

#molad_as_datetimeObject

DateTime for molad as UTC



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 125

def molad_as_datetime
  m = molad
  location_name = 'Jerusalem, Israel'
  latitude = 31.778   # Har Habayis latitude
  longitude = 35.2354 # Har Habayis longitude
  tz = TZInfo::Timezone.get('Asia/Jerusalem')

  geo = Zmanim::Util::GeoLocation.new(location_name, latitude, longitude, tz)
  seconds = (m.molad_chalakim * 10) / 3.0
  # molad as local mean time
  time = DateTime.new(m.gregorian_year, m.gregorian_month, m.gregorian_day,
                      m.molad_hours, m.molad_minutes, seconds, '+2')
  offset_hours = geo.local_mean_time_offset / Zmanim::AstronomicalCalendar::HOUR_MILLIS.to_f
  # molad as Jerusalem standard time
  time -= offset_hours / 24.0
  # molad as UTC
  time.new_offset(0)
end

#morid_hatal?Boolean

Returns:

  • (Boolean)


391
392
393
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 391

def morid_hatal?
  !mashiv_haruach? || mashiv_haruach_starts? || mashiv_haruach_ends?
end

#parshas_hashavua(current_week_only: false) ⇒ Object



177
178
179
180
181
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 177

def parshas_hashavua(current_week_only: false)
  limud = Zmanim::Limudim::Calculators::Parsha.new(in_israel: in_israel).limud(self)
  limud.clear! if current_week_only && limud.interval.end_date > end_of_week
  limud
end

#pesach(upcoming: nil, year: nil) ⇒ Object



239
240
241
242
243
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 239

def pesach(upcoming: nil, year: nil)
  find_annual_event(upcoming, year) do |y|
    JewishCalendar.new(y, 1, 15)
  end
end

#pesach_sheni(upcoming: nil, year: nil) ⇒ Object



245
246
247
248
249
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 245

def pesach_sheni(upcoming: nil, year: nil)
  find_annual_event(upcoming, year) do |y|
    JewishCalendar.new(y, 2, 14)
  end
end

#pirkei_avosObject



191
192
193
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 191

def pirkei_avos
  Zmanim::Limudim::Calculators::PirkeiAvos.new(in_israel: in_israel).limud(self)
end

#purim(upcoming: nil, year: nil) ⇒ Object



329
330
331
332
333
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 329

def purim(upcoming: nil, year: nil)
  find_annual_event(upcoming, year) do |y|
    JewishCalendar.new(y, months_in_jewish_year(y), 14)
  end
end

#rosh_chodesh(upcoming: nil, month: nil, year: nil) ⇒ Object



335
336
337
338
339
340
341
342
343
344
345
346
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 335

def rosh_chodesh(upcoming: nil, month: nil, year: nil)
  find_monthly_event(upcoming, month, year) do |m, y|
    m = 8 if m == 7
    prev = m - 1
    prev = months_in_jewish_year(y) if prev < 1
    if days_in_jewish_month(prev,y) == 30
      JewishCalendar.new(y, prev, 30)
    else
      JewishCalendar.new(y, m, 1)
    end
  end
end

#rosh_chodesh?Boolean

Returns:

  • (Boolean)


92
93
94
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 92

def rosh_chodesh?
  jewish_day == 30 || (jewish_day == 1 && jewish_month != 7)
end

#rosh_hashana(upcoming: nil, year: nil) ⇒ Object



285
286
287
288
289
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 285

def rosh_hashana(upcoming: nil, year: nil)
  find_annual_event(upcoming, year) do |y|
    JewishCalendar.new(y, 7, 1)
  end
end

#seventeen_of_tammuz(upcoming: nil, year: nil) ⇒ Object



263
264
265
266
267
268
269
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 263

def seventeen_of_tammuz(upcoming: nil, year: nil)
  find_annual_event(upcoming, year) do |y|
    date = JewishCalendar.new(y, 4, 17)
    date.forward! if date.day_of_week == 7
    date
  end
end

#shabbos_mevorchim(upcoming: nil, month: nil, year: nil) ⇒ Object



348
349
350
351
352
353
354
355
356
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 348

def shabbos_mevorchim(upcoming: nil, month: nil, year: nil)
  find_monthly_event(upcoming, month, year) do |m, y|
    m = 8 if m == 7
    prev = m - 1
    prev = months_in_jewish_year(y) if prev < 1
    mevorchim_start = JewishCalendar.new(y,prev,23)
    mevorchim_start + (7 - mevorchim_start.day_of_week)
  end
end

#shabbos_mevorchim?Boolean

Returns:

  • (Boolean)


371
372
373
374
375
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 371

def shabbos_mevorchim?
  day_of_week == 7 &&
      jewish_month != 6 &&
      (23..29).include?(jewish_day)
end

#shavuos(upcoming: nil, year: nil) ⇒ Object



257
258
259
260
261
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 257

def shavuos(upcoming: nil, year: nil)
  find_annual_event(upcoming, year) do |y|
    JewishCalendar.new(y, 3, 6)
  end
end

#significant_dayObject



29
30
31
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 29

def significant_day
  send("#{jewish_month_name}_significant_day")
end

#significant_shabbosObject



214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 214

def significant_shabbos
  return nil unless day_of_week == 7
  if jewish_month == 1
    if jewish_day == 1
      :parshas_hachodesh
    elsif jewish_day.between?(8,14)
      :shabbos_hagadol
    end
  elsif jewish_month == 7 && jewish_day.between?(3,9)
    :shabbos_shuva
  elsif jewish_month == months_in_jewish_year - 1 && jewish_day.between?(25,30)
    :parshas_shekalim
  elsif jewish_month == months_in_jewish_year
    if jewish_day == 1
      :parshas_shekalim
    elsif jewish_day.between?(7, 13)
      :parshas_zachor
    elsif jewish_day.between?(17,23)
      :parshas_parah
    elsif jewish_day.between?(24,29)
      :parshas_hachodesh
    end
  end
end

#sof_zman_kiddush_levana_15_daysObject



157
158
159
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 157

def sof_zman_kiddush_levana_15_days
  molad_as_datetime + 15
end

#sof_zman_kiddush_levana_between_moldosObject



152
153
154
155
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 152

def sof_zman_kiddush_levana_between_moldos
  half_molad_in_days = CHALAKIM_PER_MONTH.to_f / (1080 * 24 * 2)
  molad_as_datetime + half_molad_in_days
end

#succos(upcoming: nil, year: nil) ⇒ Object



305
306
307
308
309
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 305

def succos(upcoming: nil, year: nil)
  find_annual_event(upcoming, year) do |y|
    JewishCalendar.new(y, 7, 15)
  end
end

#taanis?Boolean

Returns:

  • (Boolean)


83
84
85
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 83

def taanis?
  %i(seventeen_of_tammuz tisha_beav tzom_gedalyah yom_kippur tenth_of_teves taanis_esther).include?(significant_day)
end

#taanis_bechorim?Boolean

Returns:

  • (Boolean)


87
88
89
90
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 87

def taanis_bechorim?
  (day_of_week != 7 && jewish_day == 14 && jewish_month == 1) ||   # normally 14th of nissan,
      (day_of_week == 5 && jewish_day == 12 && jewish_month == 1)  # when that falls on shabbos, moved to previous Thursday
end

#techilas_zman_kiddush_levana_3_daysObject



144
145
146
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 144

def techilas_zman_kiddush_levana_3_days
  molad_as_datetime + 3
end

#techilas_zman_kiddush_levana_7_daysObject



148
149
150
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 148

def techilas_zman_kiddush_levana_7_days
  molad_as_datetime + 7
end

#tefilah_additions(walled_city: false, nusach: :ashkenaz) ⇒ Object



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 195

def tefilah_additions(walled_city: false, nusach: :ashkenaz)
  additions = []
  if mashiv_haruach_starts?
    additions << :begin_mashiv_haruach
  elsif mashiv_haruach_ends?
    additions << (nusach == :sefard ? :begin_morid_hatal : :end_mashiv_haruach)
  else
    additions << :mashiv_haruach if mashiv_haruach?
    additions << :morid_hatal if nusach == :sefard && morid_hatal?
  end
  additions << :vesein_beracha if vesein_beracha?
  additions << :vesein_tal_umatar if vesein_tal_umatar?
  additions << :atah_yatzarta if day_of_week == 7 && rosh_chodesh?
  additions << :yaaleh_veyavo if yaaleh_veyavo?
  additions << :al_hanissim if al_hanissim?(walled_city)
  additions << :borchi_nafshi if rosh_chodesh?
  additions
end

#tehillim_portionObject



183
184
185
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 183

def tehillim_portion
  Zmanim::Limudim::Calculators::TehillimMonthly.new.limud(self)
end

#tenth_of_teves(upcoming: nil, year: nil) ⇒ Object



317
318
319
320
321
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 317

def tenth_of_teves(upcoming: nil, year: nil)
  find_annual_event(upcoming, year) do |y|
    JewishCalendar.new(y, 10, 10)
  end
end

#tisha_beav(upcoming: nil, year: nil) ⇒ Object



271
272
273
274
275
276
277
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 271

def tisha_beav(upcoming: nil, year: nil)
  find_annual_event(upcoming, year) do |y|
    date = JewishCalendar.new(y, 5, 9)
    date.forward! if date.day_of_week == 7
    date
  end
end

#tomorrow_assur_bemelacha?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 37

def tomorrow_assur_bemelacha?
  day_of_week == 6 || erev_yom_tov? || erev_yom_tov_sheni?
end

#tu_beav(upcoming: nil, year: nil) ⇒ Object



279
280
281
282
283
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 279

def tu_beav(upcoming: nil, year: nil)
  find_annual_event(upcoming, year) do |y|
    JewishCalendar.new(y, 5, 15)
  end
end

#tu_beshvat(upcoming: nil, year: nil) ⇒ Object



323
324
325
326
327
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 323

def tu_beshvat(upcoming: nil, year: nil)
  find_annual_event(upcoming, year) do |y|
    JewishCalendar.new(y, 11, 15)
  end
end

#tzom_gedalyah(upcoming: nil, year: nil) ⇒ Object



291
292
293
294
295
296
297
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 291

def tzom_gedalyah(upcoming: nil, year: nil)
  find_annual_event(upcoming, year) do |y|
    date = JewishCalendar.new(y, 7, 3)
    date.forward! if date.day_of_week == 7
    date
  end
end

#vesein_beracha?Boolean

Returns:

  • (Boolean)


424
425
426
427
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 424

def vesein_beracha?
  return false if day_of_week == 7 || yom_tov_assur_bemelacha?
  !vesein_tal_umatar?
end

#vesein_tal_umatar?Boolean

Because the jewish date does not auto-increment in the evening, we use the daytime transition (e.g. December 5/6 for 20th/21st century) as the start date and rely on the user to increment the jewish date after nightfall.

Returns:

  • (Boolean)


398
399
400
401
402
403
404
405
406
407
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 398

def vesein_tal_umatar?
  return false if day_of_week == 7 || yom_tov_assur_bemelacha?
  return true if jewish_month == 1 && jewish_day < 15
  return false if jewish_month < 8
  if in_israel
    jewish_month > 8 || (jewish_month == 8 && jewish_day >= 7)
  else
    tekufas_tishrei_elapsed_days >= 47
  end
end

#vesein_tal_umatar_start(upcoming: nil, year: nil) ⇒ Object



358
359
360
361
362
363
364
365
366
367
368
369
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 358

def vesein_tal_umatar_start(upcoming: nil, year: nil)
  find_annual_event(upcoming, year) do |y|
    start_date =
      if in_israel
        JewishCalendar.new(y, 8, 7)
      else
        JewishCalendar.new(y, 7, 1) + (47 - tekufas_tishrei_elapsed_days(1, year: y))
      end
    start_date.forward! if start_date.day_of_week == 7
    start_date
  end
end

#vesein_tal_umatar_starts?Boolean

Returns:

  • (Boolean)


409
410
411
412
413
414
415
416
417
418
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 409

def vesein_tal_umatar_starts?
  if in_israel
    # 7 Cheshvan, or 8 Cheshvan if 7 is Shabbos
    return false unless jewish_month == 8
    (day_of_week != 7 && jewish_day == 7) || (day_of_week == 1 && jewish_day == 8)
  else
    elapsed_days = tekufas_tishrei_elapsed_days
    (day_of_week != 7 && elapsed_days == 47) || (day_of_week == 1 && elapsed_days == 48)
  end
end

#vesein_tal_umatar_starts_tonight?Boolean

Returns:

  • (Boolean)


420
421
422
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 420

def vesein_tal_umatar_starts_tonight?
  succ.vesein_tal_umatar_starts?
end

#yaaleh_veyavo?Boolean

Returns:

  • (Boolean)


429
430
431
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 429

def yaaleh_veyavo?
  rosh_chodesh? || chol_hamoed? || yom_tov_assur_bemelacha?
end

#yom_kippur(upcoming: nil, year: nil) ⇒ Object



299
300
301
302
303
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 299

def yom_kippur(upcoming: nil, year: nil)
  find_annual_event(upcoming, year) do |y|
    JewishCalendar.new(y, 7, 10)
  end
end

#yom_tov?Boolean

Returns:

  • (Boolean)


49
50
51
52
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 49

def yom_tov?
  sd = significant_day
  sd && !sd.to_s.start_with?('erev_') && (!taanis? || sd == :yom_kippur)
end

#yom_tov_assur_bemelacha?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 54

def yom_tov_assur_bemelacha?
  %i(pesach shavuos rosh_hashana yom_kippur succos shemini_atzeres simchas_torah).include?(significant_day)
end

#yom_tov_sheni?Boolean

Returns:

  • (Boolean)


64
65
66
67
68
69
# File 'lib/zmanim/hebrew_calendar/jewish_calendar.rb', line 64

def yom_tov_sheni?
  (jewish_month == 7 && jewish_day == 2) ||
      (!in_israel && ((jewish_month == 7 && [16, 23].include?(jewish_day)) ||
                      (jewish_month == 1 && [16, 22].include?(jewish_day)) ||
                      (jewish_month == 3 && jewish_day == 7)))
end