Skip to content

Commit

Permalink
Merge pull request #149 from FriendsOfCake/datetimewidget
Browse files Browse the repository at this point in the history
Don't try to parse chronos objects.
  • Loading branch information
jippi authored Nov 6, 2016
2 parents 7fb5cc5 + 8acd94b commit 90d7824
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/View/Widget/DateTimeWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Cake\I18n\I18n;
use Cake\I18n\Time;
use Cake\View\Form\ContextInterface;
use DateTime;
use DateTimeInterface;

class DateTimeWidget extends \Cake\View\Widget\DateTimeWidget
{
Expand Down Expand Up @@ -39,7 +39,7 @@ public function render(array $data, ContextInterface $context)
$format = $this->_convertPHPToMomentFormat($data['data-format']);
}

if (!($val instanceof DateTime) && !empty($val)) {
if (!($val instanceof DateTimeInterface) && !empty($val)) {
$val = $type === 'date' ? Time::parseDate($val) : Time::parseDateTime($val);
}

Expand Down

0 comments on commit 90d7824

Please sign in to comment.