def getNextMonth(): month = dates.HebrewDate.today().month + 1 if hebrewcal.Year(dates.HebrewDate.today().year).leap: if month > 13: month = month - 13 else: if month > 12: month = month - 12 return month
def _hebrew_year(year): """ Return the Hebrew calendar year that corresponds to 1st January of the given Gregorian calendar year. 1st January of any Gregorian calendar year, say x, always falls into the month of Tevet (10) or Shevat (11) of some Hebrew year f(x). Also, we have f(x+1) = f(x) + 1, so that any year in the Gregorian calendar always overlaps with two consecutive years in the Hebrew calendar and vice versa. """ return hebrewcal.Year(dates.GregorianDate(year, 1, 1).to_heb().year)
def get_current_state(today=dates.HebrewDate.today()): days_count = 0 total_days = 0 # Tishrey and above if today.month >= 7: year = today.year else: year = today.year - 1 # first from Tishrey to Adar for date in hebrewcal.Year(year).iterdates(): if date.month == 1: break if date <= today: days_count += 1 total_days += 1 # then from Nissan to Elul for date in hebrewcal.Year(year + 1).iterdates(): if date.month >= 7: continue if date <= today: days_count += 1 total_days += 1 return int((days_count / total_days) * 100)
def test_equalyear(self): year1 = hebrewcal.Year(5777) year2 = hebrewcal.Year(5777) assert year1 == year2
def get_months(year): return jsonify([fix_spelling(month.name) for month in hebrewcal.Year(year).itermonths()])