Only used normalised ISO on HTML5

This commit is contained in:
Ingo Schommer 2017-04-27 11:56:18 +12:00
parent de8abe1167
commit f01a20d5c4

View File

@ -311,7 +311,13 @@ class DatetimeField extends TextField
$formatter->setLenient(false);
// Note we omit timezone from this format, and we always assume server TZ
$formatter->setPattern(DBDatetime::ISO_DATETIME_NORMALISED);
if ($this->getHTML5()) {
// ISO8601 date with a standard "T" separator (W3C standard).
$formatter->setPattern(DBDatetime::ISO_DATETIME_NORMALISED);
} else {
// ISO8601 date with a whitespace separator
$formatter->setPattern(DBDatetime::ISO_DATETIME);
}
return $formatter;
}