From 8156c059b6b56e611bbd836c63a3990af3e73f62 Mon Sep 17 00:00:00 2001 From: Andrej Griniuk Date: Fri, 10 Mar 2017 17:07:50 +0800 Subject: [PATCH 1/2] handle Time fields in DateTimeWidget --- src/View/Widget/DateTimeWidget.php | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/View/Widget/DateTimeWidget.php b/src/View/Widget/DateTimeWidget.php index 1ff8cb9a..f737a0ec 100644 --- a/src/View/Widget/DateTimeWidget.php +++ b/src/View/Widget/DateTimeWidget.php @@ -41,7 +41,13 @@ public function render(array $data, ContextInterface $context) } if (!($val instanceof DateTimeInterface) && !empty($val)) { - $val = $type === 'date' ? Time::parseDate($val) : Time::parseDateTime($val); + if ($type === 'date') { + $val = Time::parseDate($val); + } elseif ($type === 'time') { + $val = Time::parseTime($val); + } else { + $val = Time::parseDateTime($val); + } } if ($val) { @@ -54,9 +60,19 @@ public function render(array $data, ContextInterface $context) } if (!$format) { - $format = $type === 'date' ? 'L' : 'L LT'; + if ($type === 'date') { + $format = 'L'; + } elseif ($type === 'time') { + $format = 'LT'; + } else { + $format = 'L LT'; + } } + $icon = $type === 'time' + ? 'time' + : 'calendar'; + $widget = << html; From e7dbf50a778929ade196fa825a85bb00bfe95c22 Mon Sep 17 00:00:00 2001 From: Andrej Griniuk Date: Thu, 30 Mar 2017 13:07:31 +0800 Subject: [PATCH 2/2] fix cs --- src/Menu/MenuDropdown.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Menu/MenuDropdown.php b/src/Menu/MenuDropdown.php index 144405d9..ccfcb227 100644 --- a/src/Menu/MenuDropdown.php +++ b/src/Menu/MenuDropdown.php @@ -10,7 +10,6 @@ class MenuDropdown **/ protected $title; - /** * Array of MenuDivider|MenuItem entries *