Mercurial > babel > old > babel-test
diff babel/dates.py @ 240:e47245bf65b3
More work on #46 (week-of-year/week-of-month).
author | cmlenz |
---|---|
date | Tue, 07 Aug 2007 20:01:35 +0000 |
parents | 4afe02d81083 |
children | 9fedbb6f9871 |
line wrap: on
line diff
--- a/babel/dates.py +++ b/babel/dates.py @@ -746,12 +746,19 @@ def format_week(self, char, num): if char.islower(): # week of year - return self.format(self.get_week_number(self.get_day_of_year()), - num) + week = self.get_week_number(self.get_day_of_year()) + if week == 0: + # FIXME: I suppose this should return the last week number of + # the previous year + pass + return self.format(week, num) else: # week of month - # FIXME: this should really be based on the first_week_day and - # min_week_days locale data - return '%d' % ((self.value.day + 6 - self.value.weekday()) / 7 + 1) + week = self.get_week_number(self.value.day) + if week == 0: + # FIXME: I suppose this should return the last week number of + # the previous month + pass + return '%d' % week def format_weekday(self, char, num): if num < 3: