From: Tim Düsterhus Date: Fri, 5 May 2023 10:43:12 +0000 (+0200) Subject: Document `{time}` X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=14b5af640f9b279fdfef45c945b94399b54b73bf;p=GitHub%2FWoltLab%2Fwoltlab.github.io.git Document `{time}` see #340 --- diff --git a/docs/view/template-plugins.md b/docs/view/template-plugins.md index ce217b0f..d370342e 100644 --- a/docs/view/template-plugins.md +++ b/docs/view/template-plugins.md @@ -703,6 +703,31 @@ If `prepend` is used on an array as the variable, the value is prepended to all ``` +## `{time}` + +`time` allows to output times in different (human readable) formats. +Acceptables inputs are either a `\DateTimeInterface` or an integer representing a Unix timestamp. + +```smarty +{time time=$time} +{time time=$time type='plainTime'} +{time time=$time type='plainDate'} +{time time=$time type='custom' format='Y-m-d'} +``` + +| Attribute | Description | +|-----------|-------------| +| time | The `\DateTimeInterface` or Unix timestamp to format. | +| type | The output format. | + +| Type | Description | +|-----------|-------------| +| – | An interactive `` element that renders as dynamically updated relative times. | +| plainTime | Date with time in the user’s locale and timezone as a plain string. | +| plainDate | Date without time in the user’s locale and timezone as a plain string. | +| custom | A custom format that is passed to `\DateTimeInterface::format()`. The timezone will be the user’s timezone. | + + ## `|time` !!! info "This template plugin has been deprecated in WoltLab Suite 6.0."