do not include start hour in long string if it's midnight

This commit is contained in:
Frédéric Péters 2011-12-01 20:49:56 +01:00
parent db831555ad
commit 9bea4f0cc9
1 changed files with 4 additions and 1 deletions

View File

@ -39,7 +39,10 @@ class BaseEvent(Item):
def longdatetime(self):
# unfortunately this forces the locale
formatter = locales.getLocale('fr').dates.getFormatter('dateTime', 'medium')
formatter.setPattern(u'EEEE d MMMM yyyy à HH:mm')
if self.start.hour == 0 and self.start.minute == 0:
formatter.setPattern(u'EEEE d MMMM yyyy')
else:
formatter.setPattern(u'EEEE d MMMM yyyy à HH:mm')
return formatter.format(self.start)
longdatetime = property(longdatetime)