It is now possible to manually specify a format for the datetime field (fixes getgrav/grav#1261)

This commit is contained in:
Djamil Legato
2017-01-20 13:57:54 -08:00
parent 81b7dd10c7
commit d6afa39624
2 changed files with 3 additions and 1 deletions

View File

@@ -1,6 +1,8 @@
# v1.2.10
## XX/XX/2017
1. [](#improved)
* It is now possible to manually specify a format for the `datetime` field [#1261](https://github.com/getgrav/grav/issues/1261)
1. [](#bugfix)
* Fixed issue with downloaded package when installing a testing release

View File

@@ -2,7 +2,7 @@
{% set value = (value is null ? field.default : value) %}
{% set default_php_dateformat = admin.guessDateFormat(value) %}
{% set php_dateformat = admin.page.dateformat ?: config.system.pages.dateformat.default ?: default_php_dateformat %}
{% set php_dateformat = field.format ?: admin.page.dateformat ?: config.system.pages.dateformat.default ?: default_php_dateformat %}
{% set js_dateformat = admin.dateformatToMomentJS(php_dateformat) %}
{% set value = (value is null ? value : value|date(php_dateformat)) %}