Exemple #1
0
 def is_assur_bemelacha(self, current_time: datetime, tzais=None, in_israel: Optional[bool]=False):
     if tzais is None:
         tzais_time = self.tzais()
     elif isinstance(tzais, dict):
         tzais_time = self.tzais(tzais)
     else:
         tzais_time = tzais
     jewish_calendar = JewishCalendar(current_time.date())
     jewish_calendar.in_israel = in_israel
     return (current_time <= tzais_time and jewish_calendar.is_assur_bemelacha()) or \
            (current_time >= self.elevation_adjusted_sunset() and jewish_calendar.is_tomorrow_assur_bemelacha())
Exemple #2
0
def all_days_matching(year,
                      matcher,
                      in_israel=False,
                      use_modern_holidays=False):
    calendar = JewishCalendar(year, 7, 1)
    calendar.in_israel = in_israel
    calendar.use_modern_holidays = use_modern_holidays
    collection = {}
    while calendar.jewish_year == year:
        sd = matcher(calendar)
        if sd:
            if sd not in collection:
                collection[sd] = []
            collection[sd] += [
                f'{calendar.jewish_month}-{calendar.jewish_day}'
            ]
        calendar.forward()
    return collection