def rosh_hashanah(year):

        g = year % 19 + 1
        r = 12 * g % 19

        v = (floor(year / 100.0) - floor(year / 400.0) - 2)
        v += 765433.0 * r / 492480
        v += (year % 4) / 4.0
        v -= (313.0 * year + 89081) / 98496

        n = int(v)
        f = v - n

        # Monday .. Sunday = 0..6
        dow = (datetime(year, 8, 31).weekday() + n) % 7

        if dow in (2, 4, 6):
            n += 1
        elif dow == 0 and f >= 23269.0 / 25920 and r > 11:
            n += 1
        elif dow == 1 and f >= 1367.0 / 2160 and r > 6:
            n += 2

        return n
Пример #2
0
    def rosh_hashanah(year):

        g = year % 19 + 1
        r = 12 * g % 19

        v = (floor(year / 100.0) - floor(year / 400.0) - 2)
        v += 765433.0 * r / 492480
        v += (year % 4) / 4.0
        v -= (313.0 * year + 89081) / 98496

        n = int(v)
        f = v - n

        # Monday .. Sunday = 0..6
        dow = (datetime(year, 8, 31).weekday() + n) % 7

        if dow in (2, 4, 6):
            n += 1
        elif dow == 0 and f >= 23269.0 / 25920 and r > 11:
            n += 1
        elif dow == 1 and f >= 1367.0 / 2160 and r > 6:
            n += 2

        return n
 def calc_passover_year(year):
     return datetime(year, 3, 21) + timedelta(rosh_hashanah(year))
def next_month(settings):
    return datetime(year=_get_current_date().year, day=1, month=_get_current_date().month + 1), \
           get_date_format(settings)
def end_of_year(settings):
    return datetime(year=_get_current_date().year, day=31, month=12), get_date_format(settings)
def start_of_year(settings):
    return datetime(year=_get_current_date().year, day=1, month=1), get_date_format(settings)
Пример #7
0
 def calc_passover_year(year):
     return datetime(year, 3, 21) + timedelta(rosh_hashanah(year))
Пример #8
0
def next_month(settings):
    return datetime(year=_get_current_date().year, day=1, month=_get_current_date().month + 1), \
           get_date_format(settings)
Пример #9
0
def end_of_year(settings):
    return datetime(year=_get_current_date().year, day=31,
                    month=12), get_date_format(settings)
Пример #10
0
def start_of_year(settings):
    return datetime(year=_get_current_date().year, day=1,
                    month=1), get_date_format(settings)