def motzei_shabbat_chag(self): """At the given time, return whether motzei shabbat or chag""" today = HDate(gdate=self.date, diaspora=self.location.diaspora) tomorrow = HDate( gdate=self.date + dt.timedelta(days=1), diaspora=self.location.diaspora ) if (today.is_shabbat or today.is_yom_tov) and ( tomorrow.is_shabbat or tomorrow.is_yom_tov ): return False if (today.is_shabbat or today.is_yom_tov) and (self.time > self.havdalah): return True return False
def erev_shabbat_chag(self): """At the given time, return whether erev shabbat or chag""" today = HDate(gdate=self.date, diaspora=self.location.diaspora) tomorrow = HDate( gdate=self.date + dt.timedelta(days=1), diaspora=self.location.diaspora ) if ( (tomorrow.is_shabbat or tomorrow.is_yom_tov) and (not today.is_shabbat and not today.is_yom_tov) and (self.time < self.candle_lighting) ): return True return False
def issur_melacha_in_effect(self): """At the given time, return whether issur melacha is in effect.""" today = HDate(gdate=self.date, diaspora=self.location.diaspora) tomorrow = HDate(gdate=self.date + dt.timedelta(days=1), diaspora=self.location.diaspora) if (today.is_shabbat or today.is_yom_tov) and (tomorrow.is_shabbat or tomorrow.is_yom_tov): return True if (today.is_shabbat or today.is_yom_tov) and (self.time < self.havdalah): return True if (tomorrow.is_shabbat or tomorrow.is_yom_tov) and (self.time > self.candle_lighting): return True return False
def candle_lighting(self): """Return the time for candle lighting, or None if not applicable.""" today = HDate(gdate=self.date, diaspora=self.location.diaspora) tomorrow = HDate(gdate=self.date + dt.timedelta(days=1), diaspora=self.location.diaspora) # If today is a Yom Tov or Shabbat, and tomorrow is a Yom Tov or # Shabbat return the havdalah time as the candle lighting time. if (today.is_yom_tov or today.is_shabbat) and (tomorrow.is_yom_tov or tomorrow.is_shabbat): return self._havdalah_datetime # Otherwise, if today is Friday or erev Yom Tov, return candle # lighting. if tomorrow.is_shabbat or tomorrow.is_yom_tov: return self.zmanim["sunset"] - dt.timedelta( minutes=self.candle_lighting_offset) return None
def havdalah(self): """Return the time for havdalah, or None if not applicable. If havdalah_offset is 0, uses the time for three_stars. Otherwise, adds the offset to the time of sunset and uses that. If it's currently a multi-day YomTov, and the end of the stretch is after today, the havdalah value is defined to be None (to avoid misleading the user that melacha is permitted). """ today = HDate(gdate=self.date, diaspora=self.location.diaspora) tomorrow = HDate(gdate=self.date + dt.timedelta(days=1), diaspora=self.location.diaspora) # If today is Yom Tov or Shabbat, and tomorrow is Yom Tov or Shabbat, # then there is no havdalah value for today. Technically, there is # havdalah mikodesh l'kodesh, but that is represented in the # candle_lighting value to avoid misuse of the havdalah API. if today.is_shabbat or today.is_yom_tov: if tomorrow.is_shabbat or tomorrow.is_yom_tov: return None return self._havdalah_datetime return None