def get_display_date(self):
tz = timezone.get_current_timezone()
start_time = self.start_time.astimezone(tz)
end_time = self.end_time.astimezone(tz)
if start_time.date() == end_time.date():
date = formats.date_format(start_time, 'DATE_FORMAT')
return _("le {date}, de {start_hour} à {end_hour}").format(
date=date,
start_hour=formats.time_format(start_time, 'TIME_FORMAT'),
end_hour=formats.time_format(end_time, 'TIME_FORMAT')
)
return _("du {start_date}, {start_time} au {end_date}, {end_time}").format(
start_date=formats.date_format(start_time, 'DATE_FORMAT'),
start_time=formats.date_format(start_time, 'TIME_FORMAT'),
end_date=formats.date_format(end_time, 'DATE_FORMAT'),
end_time=formats.date_format(end_time, 'TIME_FORMAT'),
)
评论列表
文章目录