templatetags: get opening hours ending after midnight (#48919)
This commit is contained in:
parent
560af3110e
commit
4570380949
|
@ -134,7 +134,8 @@ def get_period_from_data(weekday, open_close_time_string=None, opening_time=None
|
|||
opening_time = openinghours_to_datetime(weekday, int(start_hour), int(start_minute))
|
||||
|
||||
all_day_hours = False
|
||||
if closing_time.hour <= 12:
|
||||
if (opening_time < closing_time # closing_time may last on the night
|
||||
and closing_time.hour <= 12):
|
||||
period = 'am'
|
||||
elif opening_time.hour <= 12:
|
||||
period = 'am'
|
||||
|
|
|
@ -88,8 +88,8 @@ def test_mairie_format_openinghours():
|
|||
('lundi', {'am': '08h30-11h30', 'pm': None}),
|
||||
('mardi', {'am': None, 'pm': '14h00-17h00'}),
|
||||
('mercredi', {'am': '10h30-18h30', 'pm': ''}),
|
||||
('jeudi', {'am': '22h30-00h30', 'pm': None}), # wrong
|
||||
('vendredi', {'am': '07h30-07h00', 'pm': None}), # wrong
|
||||
('jeudi', {'am': None, 'pm': '22h30-00h30'}),
|
||||
('vendredi', {'am': '07h30-07h00', 'pm': ''}),
|
||||
]
|
||||
|
||||
|
||||
|
@ -136,6 +136,6 @@ def test_mairie_format_openinghoursspecification():
|
|||
('lundi', {'am': '08h30-11h30', 'pm': None}),
|
||||
('mardi', {'am': None, 'pm': '14h00-17h00'}),
|
||||
('mercredi', {'am': '10h30-18h30', 'pm': ''}),
|
||||
('jeudi', {'am': '22h30-00h30', 'pm': None}), # wrong
|
||||
('vendredi', {'am': '07h30-07h00', 'pm': None}), # wrong
|
||||
('jeudi', {'am': None, 'pm': '22h30-00h30'}),
|
||||
('vendredi', {'am': '07h30-07h00', 'pm': ''}),
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue