mirror of
https://gitlab.com/ansol/web-ansol.org.git
synced 2024-11-27 00:07:43 +00:00
18 lines
982 B
HTML
18 lines
982 B
HTML
{{/* Function to get event start and end dates/times. */}}
|
|
{{ $t1 := time .Date }}{{/* Start datetime. */}}
|
|
{{ $str := slice ((time $t1).Format site.Params.date_format) }}{{/* Init return string with start date. */}}
|
|
{{/* Show start time if not all day event. */}}
|
|
{{ if not .Params.all_day }}{{ $str = $str | append ((time $t1).Format (site.Params.time_format)) }}{{ end }}
|
|
{{/* Show event end date if provided. */}}
|
|
{{ if .Params.date_end }}
|
|
{{ $str = $str | append "—" }}
|
|
{{ $t2 := time .Params.date_end}}{{/* End datetime. */}}
|
|
{{/* Show end date if it differs to start date. */}}
|
|
{{ if not (eq $t1.Year $t2.Year | and (eq $t1.Month $t2.Month) | and (eq $t1.Day $t2.Day)) }}
|
|
{{ $str = $str | append ((time $t2).Format site.Params.date_format) }}
|
|
{{ end }}
|
|
{{/* Show end time if not all day event. */}}
|
|
{{ if not .Params.all_day }}{{ $str = $str | append ((time $t2).Format (site.Params.time_format)) }}{{ end }}
|
|
{{ end }}
|
|
{{ return (delimit $str " ") }}
|