Ejemplo n.º 1
0
 def __init__(self, ahead_months):
     end = compute_ahead_months(ahead_months)
     end_plus_one = end + ONE_DAY
     start = end_plus_one.replace(year=end_plus_one.year - 1)
     if start.day != 1:
         start = inc_date(start, RepeatType.Monthly, 1).replace(day=1)
     DateRange.__init__(self, start, end)
     self.ahead_months = ahead_months
Ejemplo n.º 2
0
 def __init__(self, ahead_months):
     end = compute_ahead_months(ahead_months)
     end_plus_one = end + ONE_DAY
     start = end_plus_one.replace(year=end_plus_one.year-1)
     if start.day != 1:
         start = inc_date(start, RepeatType.Monthly, 1).replace(day=1)
     DateRange.__init__(self, start, end)
     self.ahead_months = ahead_months
Ejemplo n.º 3
0
 def __init__(self, seed, year_start_month=1):
     assert 1 <= year_start_month <= 12
     if isinstance(seed, DateRange):
         seed = seed.start
     year = seed.year
     if seed.month < year_start_month:
         year -= 1
     start = date(year, year_start_month, 1)
     end = inc_date(start, RepeatType.Yearly, 1) - ONE_DAY
     DateRange.__init__(self, start, end)
Ejemplo n.º 4
0
 def __init__(self, seed, year_start_month=1):
     assert 1 <= year_start_month <= 12
     if isinstance(seed, DateRange):
         seed = seed.start
     year = seed.year
     if seed.month < year_start_month:
         year -= 1
     start = date(year, year_start_month, 1)
     end = inc_date(start, RepeatType.Yearly, 1) - ONE_DAY
     DateRange.__init__(self, start, end)
Ejemplo n.º 5
0
 def prev(self):
     start = inc_date(self.start, RepeatType.Yearly, -1)
     end = inc_date(self.end, RepeatType.Yearly, -1)
     return DateRange(start, end)
Ejemplo n.º 6
0
 def prev(self):
     return YearRange(inc_date(self.start, RepeatType.Yearly, -1),
                      year_start_month=self.start.month)
Ejemplo n.º 7
0
 def prev(self):
     start = inc_date(self.start, RepeatType.Yearly, -1)
     end = inc_date(self.end, RepeatType.Yearly, -1)
     return DateRange(start, end)
Ejemplo n.º 8
0
 def prev(self):
     return YearRange(inc_date(self.start, RepeatType.Yearly, -1), year_start_month=self.start.month)