Skip to content

Commit

Permalink
Don't try to parse chronos objects.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Nov 6, 2016
1 parent 7fb5cc5 commit 63ba09b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/View/Widget/DateTimeWidget.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
namespace CrudView\View\Widget;

use Cake\Chronos\ChronosInterface;
use Cake\Core\Configure;
use Cake\I18n\I18n;
use Cake\I18n\Time;
Expand Down Expand Up @@ -39,7 +40,7 @@ public function render(array $data, ContextInterface $context)
$format = $this->_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);
}

Expand Down

0 comments on commit 63ba09b

Please sign in to comment.