From 63ba09b84395ad04eab282cf2742188e9064c8fa Mon Sep 17 00:00:00 2001 From: ADmad Date: Sun, 6 Nov 2016 23:27:48 +0530 Subject: [PATCH 1/2] Don't try to parse chronos objects. --- src/View/Widget/DateTimeWidget.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/View/Widget/DateTimeWidget.php b/src/View/Widget/DateTimeWidget.php index ad927d42..1b0aaa24 100644 --- a/src/View/Widget/DateTimeWidget.php +++ b/src/View/Widget/DateTimeWidget.php @@ -1,6 +1,7 @@ _convertPHPToMomentFormat($data['data-format']); } - if (!($val instanceof DateTime) && !empty($val)) { + if (!($val instanceof DateTime || $val instanceof ChronosInterface) && !empty($val)) { $val = $type === 'date' ? Time::parseDate($val) : Time::parseDateTime($val); } From 8acd94b918b37d7fbd1af0c0663a0c4332e4cf0d Mon Sep 17 00:00:00 2001 From: ADmad Date: Mon, 7 Nov 2016 01:31:18 +0530 Subject: [PATCH 2/2] Simply check for datetime / chronos object. --- src/View/Widget/DateTimeWidget.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/View/Widget/DateTimeWidget.php b/src/View/Widget/DateTimeWidget.php index 1b0aaa24..20e61e40 100644 --- a/src/View/Widget/DateTimeWidget.php +++ b/src/View/Widget/DateTimeWidget.php @@ -1,12 +1,11 @@ _convertPHPToMomentFormat($data['data-format']); } - if (!($val instanceof DateTime || $val instanceof ChronosInterface) && !empty($val)) { + if (!($val instanceof DateTimeInterface) && !empty($val)) { $val = $type === 'date' ? Time::parseDate($val) : Time::parseDateTime($val); }