[% UNLESS TIME_FORMAT; TIME_FORMAT = '%l:%M %p'; END; time_format = TIME_FORMAT; USE date (format = time_format); today = date.format(format = '%Y-%m-%d '); # We need to add "today" to the opening/closing hours for Date input -%]

[% l('Opening hours') %]

[%- open = today _ ctx.hours.dow_0_open; close = today _ ctx.hours.dow_0_close; note = ctx.hours.dow_0_note; IF open == close; %]
[% l('Monday: closed') %]
[%- ELSE %]
[% l('Monday: [_1] - [_2]', '', '') -%] [% IF ctx.hours.dow_0_note %] [%l('(' _ note _ ')')%] [% END -%]
[%- END %] [%- open = today _ ctx.hours.dow_1_open; close = today _ ctx.hours.dow_1_close; note = ctx.hours.dow_1_note; IF open == close; %]
[% l('Tuesday: closed') %]
[%- ELSE %]
[% l('Tuesday: [_1] - [_2]', '', '') -%] [% IF ctx.hours.dow_1_note %] [%l('(' _ note _ ')')%] [% END -%]
[%- END %] [%- open = today _ ctx.hours.dow_2_open; close = today _ ctx.hours.dow_2_close; note = ctx.hours.dow_2_note; IF open == close; %]
[% l('Wednesday: closed') %]
[%- ELSE %]
[% l('Wednesday: [_1] - [_2]', '', '') -%] [% IF ctx.hours.dow_2_note %] [%l('(' _ note _ ')')%] [% END -%]
[%- END %] [%- open = today _ ctx.hours.dow_3_open; close = today _ ctx.hours.dow_3_close; note = ctx.hours.dow_3_note; IF open == close; %]
[% l('Thursday: closed') %]
[%- ELSE %]
[% l('Thursday: [_1] - [_2]', '', '') -%] [% IF ctx.hours.dow_3_note %] [%l('(' _ note _ ')')%] [% END -%]
[%- END %] [%- open = today _ ctx.hours.dow_4_open; close = today _ ctx.hours.dow_4_close; note = ctx.hours.dow_4_note; IF open == close; %]
[% l('Friday: closed') %]
[%- ELSE %]
[% l('Friday: [_1] - [_2]', '', '') -%] [% IF ctx.hours.dow_4_note %] [%l('(' _ note _ ')')%] [% END -%]
[%- END %] [%- open = today _ ctx.hours.dow_5_open; close = today _ ctx.hours.dow_5_close; note = ctx.hours.dow_5_note; IF open == close; %]
[% l('Saturday: closed') %]
[%- ELSE %]
[% l('Saturday: [_1] - [_2]', '', '') -%] [% IF ctx.hours.dow_5_note %] [%l('(' _ note _ ')')%] [% END -%]
[%- END %] [%- open = today _ ctx.hours.dow_6_open; close = today _ ctx.hours.dow_6_close; note = ctx.hours.dow_6_note; IF open == close; %]
[% l('Sunday: closed') %]
[%- ELSE %]
[% l('Sunday: [_1] - [_2]', '', '') -%] [% IF ctx.hours.dow_6_note %] [%l('(' _ note _ ')')%] [% END -%]
[%- END %]