Skip to content

Commit

Permalink
Merge pull request #163 from FriendsOfCake/datetime-widget
Browse files Browse the repository at this point in the history
Use Date::parseDate() to parse date only string.
  • Loading branch information
lorenzo authored Jun 22, 2017
2 parents 06f853f + a91ffe6 commit c892d05
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
Expand Up @@ -2,6 +2,7 @@
namespace CrudView\View\Widget;

use Cake\Core\Configure;
use Cake\I18n\Date;
use Cake\I18n\I18n;
use Cake\I18n\Time;
use Cake\View\Form\ContextInterface;
Expand Down Expand Up @@ -42,7 +43,7 @@ public function render(array $data, ContextInterface $context)

if (!($val instanceof DateTimeInterface) && !empty($val)) {
if ($type === 'date') {
$val = Time::parseDate($val);
$val = Date::parseDate($val);
} elseif ($type === 'time') {
$val = Time::parseTime($val);
} else {
Expand Down

0 comments on commit c892d05

Please sign in to comment.