Skip to content

Commit 9e30d71

Browse files
authored
Merge pull request #375 from WoltLab/time-function
Document `{time}`
2 parents 5fe1f3f + 14b5af6 commit 9e30d71

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

docs/view/template-plugins.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,31 @@ If `prepend` is used on an array as the variable, the value is prepended to all
703703
```
704704

705705

706+
## `{time}`
707+
708+
`time` allows to output times in different (human readable) formats.
709+
Acceptables inputs are either a `\DateTimeInterface` or an integer representing a Unix timestamp.
710+
711+
```smarty
712+
{time time=$time}
713+
{time time=$time type='plainTime'}
714+
{time time=$time type='plainDate'}
715+
{time time=$time type='custom' format='Y-m-d'}
716+
```
717+
718+
| Attribute | Description |
719+
|-----------|-------------|
720+
| time | The `\DateTimeInterface` or Unix timestamp to format. |
721+
| type | The output format. |
722+
723+
| Type | Description |
724+
|-----------|-------------|
725+
|| An interactive `<woltlab-core-date-time>` element that renders as dynamically updated relative times. |
726+
| plainTime | Date with time in the user’s locale and timezone as a plain string. |
727+
| plainDate | Date without time in the user’s locale and timezone as a plain string. |
728+
| custom | A custom format that is passed to `\DateTimeInterface::format()`. The timezone will be the user’s timezone. |
729+
730+
706731
## `|time`
707732

708733
!!! info "This template plugin has been deprecated in WoltLab Suite 6.0."

0 commit comments

Comments
 (0)