32 lines
No EOL
1.1 KiB
HTML
32 lines
No EOL
1.1 KiB
HTML
{{ $currentTime := now.Format "15:04" }}
|
|
{{ $currentDay := now.Format "Monday" }}
|
|
{{ $isOpen := false }}
|
|
{{ $holidayInfo := dict }}
|
|
{{ $isHoliday := false }}
|
|
|
|
<!-- Check if today is a holiday -->
|
|
{{ range .Site.Data.hours.holidays }}
|
|
{{ $holidayDate := time .date }}
|
|
{{ if eq (now.Format "2006-01-02") ($holidayDate.Format "2006-01-02") }}
|
|
{{ $isHoliday = true }}
|
|
{{ $holidayInfo = . }}
|
|
{{ if not .closed }}
|
|
{{ if and (ge $currentTime .open) (le $currentTime .close) }}
|
|
{{ $isOpen = true }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
<!-- If not a holiday, check regular hours -->
|
|
{{ if not $isHoliday }}
|
|
{{ range .Site.Data.hours.regular_hours }}
|
|
{{ if in .days $currentDay }}
|
|
{{ if and (ge $currentTime .open) (le $currentTime .close) }}
|
|
{{ $isOpen = true }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ return dict "isOpen" $isOpen "isHoliday" $isHoliday "holidayInfo" $holidayInfo "currentDay" $currentDay "currentTime" $currentTime }} |