{{ $now := now }} {{ $currentDay := $now.Format "Monday" }} {{ $currentTime := $now.Format "15:04" }}

{{ i18n "opening_hours" }}

{{ range .Site.Data.hours.regular_hours }} {{ $isOpen := and (in .days $currentDay) (ge $currentTime .open) (le $currentTime .close) }}
{{ $numDays := len .days }} {{ if eq $numDays 1 }} {{ index .days 0 }} {{ else if eq $numDays 2 }} {{ i18n (index .days 0) }} & {{ i18n (index .days 1) }} {{ else }} {{ $lastIndex := sub $numDays 1 }} {{ range $i, $day := .days }} {{ if eq $i 0 }} {{ i18n $day }} {{ else if eq $i $lastIndex }} - {{ i18n $day }} {{ end }} {{ end }} {{ end }}
{{ .open }} - {{ .close }}
{{ i18n "delivery_until" }} {{ .close }}
{{ if $isOpen }} {{ end }}
{{ end }}
{{ range .Site.Data.hours.holidays }} {{ $holidayDate := time .date }} {{ if eq ($now.Format "2006-01-02") ($holidayDate.Format "2006-01-02") }}
{{ .name }}: {{ if .closed }} {{ i18n "closed" }} {{ else }} {{ .open }} - {{ .close }} Uhr
{{ i18n "delivery_until" }} {{ .delivery_until }} Uhr
{{ end }}
{{ end }} {{ end }}