Exemplo n.º 1
0
def snct_minc(date, diff):

    diff = int(diff)
    _date = date_to_dict(date)
    sign = diff/abs(diff)
    sift = 0
    for i in xrange(min(0, diff), max(0, diff)):
        sift += num_days_in_month(_date[1], _date[2])
        _date = date_shift(
            *(_date + [sign*sift])
        )
    return yyyy_mm_dd(_date)
Exemplo n.º 2
0
 def formatmonthname(self, theyear, themonth, withyear=True):
     with calendar.TimeEncoding(self.locale) as encoding:
         s = calendar.month_name[themonth]
         if encoding is not None:
             s = s.decode(encoding)
         if withyear and theyear != self.today.year:
             s = '%s, %s' % (s, theyear)
         prev_month_day = yyyy_mm_dd(
             date_shift(1, themonth, theyear, -1)
         )
         next_month_day = yyyy_mm_dd(
             date_shift(
                 num_days_in_month(themonth,theyear),
                 themonth, theyear, 1
             )
         )
         return (
             '<tr><th colspan="7" class="month">'
             '<a href="#" day="%s" class="get_bio_data">&larr;</a> '
             '%s'
             ' <a href="#" day="%s" class="get_bio_data">&rarr;</a>'
             '</th></tr>'
         )% (prev_month_day, s, next_month_day)