diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2021-07-27 13:45:05 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2021-07-27 19:02:48 +0200 |
commit | efa5760db5ef39ae084bfccb5b8f756c7b117a2a (patch) | |
tree | 7c70d6665f34ca25a443f5a51ce956a3fa729282 /docs | |
parent | a57dda854b5efd3429af5f0b1564fc9d9d5439b9 (diff) |
Add timezone support for front matter dates without one
Fixes #8810
Diffstat (limited to 'docs')
-rw-r--r-- | docs/content/en/functions/time.md | 6 | ||||
-rw-r--r-- | docs/content/en/getting-started/configuration.md | 3 |
2 files changed, 7 insertions, 2 deletions
diff --git a/docs/content/en/functions/time.md b/docs/content/en/functions/time.md index c4f74215b..6c7f5aec6 100644 --- a/docs/content/en/functions/time.md +++ b/docs/content/en/functions/time.md @@ -11,7 +11,7 @@ menu: docs: parent: "functions" keywords: [dates,time,location] -signature: ["time INPUT [LOCATION]"] +signature: ["time INPUT [TIMEZONE]"] workson: [] hugoversion: "v0.77.0" relatedfuncs: [] @@ -29,10 +29,12 @@ aliases: [] ## Using Locations -The optional `LOCATION` parameter is a string that sets a default location that is associated with the specified time value. If the time value has an explicit timezone or offset specified, it will take precedence over the `LOCATION` parameter. +The optional `TIMEZONE` parameter is a string that sets a default time zone (or more specific, the location, which represents the collection of time offsets in a geographical area) that is associated with the specified time value. If the time value has an explicit timezone or offset specified, it will take precedence over the `TIMEZONE` parameter. The list of valid locations may be system dependent, but should include `UTC`, `Local`, or any location in the [IANA Time Zone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). +If no `TIMEZONE` is set, the `timeZone` from site configuration will be used. + ``` {{ time "2020-10-20" }} → 2020-10-20 00:00:00 +0000 UTC {{ time "2020-10-20" "America/Los_Angeles" }} → 2020-10-20 00:00:00 -0700 PDT diff --git a/docs/content/en/getting-started/configuration.md b/docs/content/en/getting-started/configuration.md index 36c8c1b50..3f236dc02 100644 --- a/docs/content/en/getting-started/configuration.md +++ b/docs/content/en/getting-started/configuration.md @@ -299,6 +299,9 @@ themesDir ("themes") timeout (10000) : Timeout for generating page contents, in milliseconds (defaults to 10 seconds). *Note:* this is used to bail out of recursive content generation, if your pages are slow to generate (e.g., because they require large image processing or depend on remote contents) you might need to raise this limit. +timeZone {{< new-in "0.86.0" >}} +: The time zone (or location), e.g. `Europe/Oslo`, used to parse front matter dates without such information and in the [`time` function](/functions/time/). + title ("") : Site title. |