Closed kseistrup closed 8 years ago
With this small patch datetimes are made customizable either in the individual templates or as a global default set by the DATETIME_FORMAT variable.
DATETIME_FORMAT
If the datetime filter is given an argument in a template, that value will be used in formatting the string. E.g.:
datetime
<td>{{ h.time|datetime('%d-%b-%Y %H:%M') }}</td>
could result in
<td>23-Jan-2016 12:34</td>
If no arguments are given, realms-wiki will attempt to use the formatting template from the DATETIME_FORMAT variable, e.g.:
realms-wiki
{ "ALLOW_ANON": false, "BASE_URL": "http://localhost", "CACHE_TYPE": "simple", "DATETIME_FORMAT": "%F %T", "DB_URI": "sqlite:////tmp/wiki.db", "PORT": 5000, "REGISTRATION_ENABLED": true, "SEARCH_TYPE": "simple", "SECRET_KEY": "ey2hYoYyg2CeA22Q9ZX8Jcn8", "SITE_TITLE": "Realms", "WIKI_PATH": "/tmp/wiki" }
<td>2016-01-23 12:34:56</td>
Finally, if the DATETIME_FORMAT variable is absent from the config, the default value of '%b %d, %Y %I:%M %p' is used:
'%b %d, %Y %I:%M %p'
<td>Jan 23, 2016 12:34 PM</td>
With this small patch datetimes are made customizable either in the individual templates or as a global default set by the
DATETIME_FORMAT
variable.If the
datetime
filter is given an argument in a template, that value will be used in formatting the string. E.g.:could result in
If no arguments are given,
realms-wiki
will attempt to use the formatting template from theDATETIME_FORMAT
variable, e.g.:could result in
Finally, if the
DATETIME_FORMAT
variable is absent from the config, the default value of'%b %d, %Y %I:%M %p'
is used: