.
This commit is contained in:
parent
071a4d8a97
commit
4d3ca1c554
39 changed files with 3386 additions and 0 deletions
32
layouts/partials/check-open-status.html
Normal file
32
layouts/partials/check-open-status.html
Normal file
|
@ -0,0 +1,32 @@
|
|||
{{ $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 }}
|
Loading…
Add table
Add a link
Reference in a new issue