From: Tim Düsterhus Date: Thu, 25 May 2023 09:22:45 +0000 (+0200) Subject: Add `machine` output type to `{time}` X-Git-Tag: 6.0.0_Alpha_1~75^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2f256efa9b0b7012c05bdf606583aa5e6c2c7747;p=GitHub%2FWoltLab%2FWCF.git Add `machine` output type to `{time}` This will output a machine-readable version of the datetime, i.e. the ISO-8601 format. This is intended as a replacement for `{$foo|date:'c'}`. --- diff --git a/wcfsetup/install/files/lib/system/template/plugin/TimeFunctionTemplatePlugin.class.php b/wcfsetup/install/files/lib/system/template/plugin/TimeFunctionTemplatePlugin.class.php index 85fc14e016..6c411ada5d 100644 --- a/wcfsetup/install/files/lib/system/template/plugin/TimeFunctionTemplatePlugin.class.php +++ b/wcfsetup/install/files/lib/system/template/plugin/TimeFunctionTemplatePlugin.class.php @@ -16,6 +16,7 @@ use wcf\system\WCF; * {time time=$timestamp} * {time time=$timestamp type='plainTime'} * {time time=$timestamp type='plainDate'} + * {time time=$timestamp type='machine'} * {time time=$timestamp type='custom' format='Y-m-d'} * * @author Tim Duesterhus, Marcel Werk @@ -82,6 +83,8 @@ final class TimeFunctionTemplatePlugin implements IFunctionTemplatePlugin ], $locale ); + case 'machine': + return $dateTime->format(\DateTimeInterface::ATOM); case 'custom': return $dateTime->format($tagArgs['format']); default: