def new_year(cls, gregorian_year): """Return the list of ordinal dates of Tibetan New Year in Gregorian year, 'gregorian_year'.""" dec31 = GregorianDate.year_end(gregorian_year) t_year = cls.fromordinal(dec31).year return list_range( [cls.losar(t_year - 1), cls.losar(t_year)], GregorianDate.year_range(gregorian_year))
def hindu_lunar_holiday(l_month, l_day, gregorian_year): """Return the list of ordinal dates of occurrences of Hindu lunar month, month, day, day, in Gregorian year, 'gregorian_year'.""" l_year = HinduLunarDate.fromordinal( GregorianDate.new_year(gregorian_year)).year date1 = hindu_date_occur(l_month, l_day, l_year) date2 = hindu_date_occur(l_month, l_day, l_year + 1) return list_range([date1, date2], GregorianDate.year_range(gregorian_year))
def hindu_lunar_event(l_month, tithi, tee, gregorian_year): """Return the list of ordinal dates of occurrences of Hindu lunar tithi prior to sundial time, tee, in Hindu lunar month, l_month, in Gregorian year, 'gregorian_year'.""" l_year = HinduLunarDate.fromordinal( GregorianDate.new_year(gregorian_year)).year date1 = hindu_tithi_occur(l_month, tithi, tee, l_year) date2 = hindu_tithi_occur(l_month, tithi, tee, l_year + 1) return list_range([date1, date2], GregorianDate.year_range(gregorian_year))
def julian_in_gregorian(julian_month, julian_day, gregorian_year): """Return the list of the ordinal dates of Julian month 'julian_month', day 'julian_day' that occur in Gregorian year 'gregorian_year'.""" jan1 = GregorianDate.new_year(gregorian_year) y = JulianDate.fromordinal(jan1).year y_prime = 1 if (y == -1) else (y + 1) date1 = JulianDate(y, julian_month, julian_day).toordinal() date2 = JulianDate(y_prime, julian_month, julian_day).toordinal() return list_range([date1, date2], GregorianDate.year_range(gregorian_year))
def in_gregorian(cls, coptic_month, coptic_day, gregorian_year): """Return the list of the ordinal dates of Coptic month 'coptic_month', day 'coptic_day' that occur in Gregorian year 'gregorian_year'.""" jan1 = GregorianDate.new_year(gregorian_year) y = cls.fromordinal(jan1).year date1 = CopticDate(y, coptic_month, coptic_day).toordinal() date2 = CopticDate(y + 1, coptic_month, coptic_day).toordinal() return list_range([date1, date2], GregorianDate.year_range(gregorian_year))
def yahrzeit_in_gregorian(self, gregorian_year): """Return the list of the ordinal dates of death date death_date (yahrzeit) that occur in Gregorian year 'gregorian_year'.""" jan1 = GregorianDate.new_year(gregorian_year) y = HebrewDate.fromordinal(jan1).year date1 = self.yahrzeit(y) date2 = self.yahrzeit(y + 1) return list_range([date1, date2], GregorianDate.year_range(gregorian_year))
def birthday_in_gregorian(self, gregorian_year): """Return the list of the ordinal dates of Hebrew birthday birthday that occur in Gregorian 'gregorian_year'.""" jan1 = GregorianDate.new_year(gregorian_year) y = HebrewDate.fromordinal(jan1).year date1 = self.birthday(y) date2 = self.birthday(y + 1) return list_range([date1, date2], GregorianDate.year_range(gregorian_year))
def in_gregorian(cls, month, day, gregorian_year): """Return list of the ordinal dates of Islamic month 'month', day 'day' that occur in Gregorian year 'gregorian_year'.""" jan1 = GregorianDate.new_year(gregorian_year) y = cls.fromordinal(jan1).year date1 = IslamicDate(y, month, day).toordinal() date2 = IslamicDate(y + 1, month, day).toordinal() date3 = IslamicDate(y + 2, month, day).toordinal() return list_range([date1, date2, date3], GregorianDate.year_range(gregorian_year))
def tzom_tevet(cls, gregorian_year): """Return the list of ordinal dates for Tzom Tevet (Tevet 10) that occur in Gregorian year 'gregorian_year'. It can occur 0, 1 or 2 times per Gregorian year.""" jan1 = GregorianDate.new_year(gregorian_year) y = HebrewDate.fromordinal(jan1).year d1 = HebrewDate(y, HebrewMonth.TEVET, 10).toordinal() d1 = d1 + (1 if weekday_fromordinal(d1) == DayOfWeek.SATURDAY else 0) d2 = HebrewDate(y + 1, HebrewMonth.TEVET, 10).toordinal() d2 = d2 + (1 if weekday_fromordinal(d2) == DayOfWeek.SATURDAY else 0) dates = [d1, d2] return list_range(dates, GregorianDate.year_range(gregorian_year))
def in_gregorian(cls, month, day, gregorian_year): """Return list of the ordinal dates of Hebrew month, 'month', day, 'day', that occur in Gregorian year 'gregorian_year'.""" jan1 = GregorianDate.new_year(gregorian_year) y = HebrewDate.fromordinal(jan1).year date1 = HebrewDate(y, month, day).toordinal() date2 = HebrewDate(y + 1, month, day).toordinal() # Hebrew and Gregorian calendar are aligned but certain # holidays, i.e. Tzom Tevet, can fall on either side of Jan 1. # So we can have 0, 1 or 2 occurences of that holiday. dates = [date1, date2] return list_range(dates, GregorianDate.year_range(gregorian_year))