Skip to content
Permalink
Browse files

Fix DateTime Widget display

This is to resolve two of the issues mentioned here:
#6518

The `_secondSelect()` function had the second select form field numbered
1 to 60, it has been changed to match the minute display to go from 0 to
59.

The `minute` field was rendering the 00 string as a float value after it
goes through the interval adjustment in `_adjustValue()`, so the result
did not match the 00 string if a user selected it and was defaulting to
the `empty` field when the `empty` option was enabled. The resulting
adjusted `minute` field is now re-casted to string and re-padded again
after the adjustment is done.
  • Loading branch information...
Kelvin Mok
Kelvin Mok committed May 8, 2015
1 parent 5b475a1 commit b08319e415a2f76b3ec7e643eb97831e635f1299
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/View/Widget/DateTimeWidget.php
@@ -240,6 +240,7 @@ protected function _deconstructDate($value, $options)
}
if (!empty($dateArray['minute']) && isset($options['minute']['interval'])) {
$dateArray['minute'] += $this->_adjustValue($dateArray['minute'], $options['minute']);
$dateArray['minute'] = str_pad(strval($dateArray['minute']), 2, '0', STR_PAD_LEFT);
}
return $dateArray;
@@ -474,7 +475,7 @@ protected function _secondSelect($options, $context)
'val' => null,
'leadingZeroKey' => true,
'leadingZeroValue' => true,
'options' => $this->_generateNumbers(1, 60)
'options' => $this->_generateNumbers(0, 59)
];
unset($options['leadingZeroKey'], $options['leadingZeroValue']);

0 comments on commit b08319e

Please sign in to comment.
You can’t perform that action at this time.