From f01a20d5c4b46715e07ddcaa673aa8025f9890a0 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 27 Apr 2017 11:56:18 +1200 Subject: [PATCH] Only used normalised ISO on HTML5 --- src/Forms/DatetimeField.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Forms/DatetimeField.php b/src/Forms/DatetimeField.php index c551f1a31..e97679927 100644 --- a/src/Forms/DatetimeField.php +++ b/src/Forms/DatetimeField.php @@ -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; }