1
0
Fork 0
datetime.link/templates/index.txt

39 lines
1.2 KiB
Plaintext

{{- $app := .App -}}
{{- $t := .Req.Time -}}
{{- range $index, $zoneName := .Req.Zones -}}
{{- with resolveZone $app $zoneName -}}
{{- if .Error}}
Unable to load zone "{{$zoneName | thisIsSafe}}". The zone could be invalid
{{/* */}}
{{- else -}}
{{- $zt := $t.In .Location -}}
{{- if ne $index 0}}
{{/* */}}
{{- end -}}
{{.Name | thisIsSafe}}
{{- if not .IsOffset }} {{.TimeOffset $t | formatOffset | thisIsSafe}}
{{- end}}
{{$zt.Format "2006-01-02"}}
{{$zt.Format "15:04"}}
{{/* */}}
{{- end -}}
{{- end -}}
{{- else -}}
Usage: https://datetime.link/DATETIME/ZONE_LIST
DATETIME: Follows RFC3339 (based on ISO 8601)
Examples: 2006-01-02T15:04:05-07:00
2020-11-10T17:17:00+08:00
1970-01-01T00:00:00Z
ZONE_LIST: A comma-separated list of zone IDs
Zone IDs can be found at https://datetime.link/data/cities.json
Zone IDs can also be fixed offsets
Examples: Singapore-SG,+06:00,-08:30,London-England-GB
St_John's-Newfoundland_and_Labrador-CA
Tiruchirappalli-Tamil_Nadu-IN,New_York_City-New_York-US
For more information: https://serverwentdown.github.io/datetime.link/
{{/* */}}
{{- end -}}