templatetags: correct timezone on openinghour specification (#48919)
This commit is contained in:
parent
23f6a7f14d
commit
3b2d0c9b01
|
@ -80,8 +80,6 @@ def get_open_close_from_specification(specification, valid_from, base_datetime):
|
|||
'''
|
||||
opening_time = datetime.datetime.combine(base_datetime, dateutil_parse(specification['opens']).time())
|
||||
closing_time = datetime.datetime.combine(base_datetime, dateutil_parse(specification['closes']).time())
|
||||
opening_time = opening_time.replace(tzinfo=valid_from.tzinfo)
|
||||
closing_time = closing_time.replace(tzinfo=valid_from.tzinfo)
|
||||
if not isinstance(specification['dayOfWeek'], str):
|
||||
raise ValueError()
|
||||
day_number = EN_FULL_WEEKDAYS_LIST.index(specification['dayOfWeek'].split('/')[-1])
|
||||
|
|
|
@ -93,7 +93,7 @@ def test_jonage_open():
|
|||
assert test_html == mark_safe(u'<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
||||
|
||||
|
||||
@pytest.mark.freeze_time("2018-03-05 10:32:00")
|
||||
@pytest.mark.freeze_time("2018-03-05 11:32:00")
|
||||
def test_jonage_soon_to_be_closed():
|
||||
"Jonage is defined only by openinghoursspecification data"
|
||||
test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['nom'] == 'Mairie de Jonage'][0]
|
||||
|
@ -215,7 +215,7 @@ def test_mairie_format_openinghours(openinghour, badge, text):
|
|||
('Tuesday', '14:30', '17:45', 'closed', 'Réouvre demain à 14h30'),
|
||||
('Monday', '14:30', '17:45', 'closed', 'Réouvre à 14h30'),
|
||||
('Monday', '08:30', '11:45', 'closed', 'Ouvre à 8h30'),
|
||||
('Monday', '00:00', '00:45', 'closed', 'Fermé'), # wrong
|
||||
('Monday', '00:00', '00:45', 'soon-to-be-closed', "Ouvert jusqu'à 0h45"),
|
||||
('Sunday', '20:30', '00:45', 'closed', 'Réouvre dimanche à 20h30'), # wrong
|
||||
])
|
||||
def test_mairie_format_openinghoursspecification(day, opens, closes, badge, text):
|
||||
|
|
Loading…
Reference in New Issue