Summary | hourminutesecond form incorrectly shows '00' selected for blank dates |
Queue | Horde Framework Packages |
Queue Version | HEAD |
Type | Bug |
State | Resolved |
Priority | 2. Medium |
Owners | chuck (at) horde (dot) org |
Requester | robin (at) rainton (dot) com |
Created | 01/04/2006 (7112 days ago) |
Due | |
Updated | 01/08/2006 (7108 days ago) |
Assigned | 01/07/2006 (7109 days ago) |
Resolved | 01/08/2006 (7108 days ago) |
Github Issue Link | |
Github Pull Request | |
Milestone | |
Patch | No |
State ⇒ Resolved
show up as 5 mm.
State ⇒ Assigned
refresehed form. This is because on the refresh the time values are
nothing ('') as per the option and this is then converted to zero.
Checking for empty values is a better option:
$this->_selectOptions($hours, (empty($time['hour'])) ? '' :
sprintf('%02d', $time['hour'])),
&
$this->_selectOptions($minutes, (empty($time['minute'])) ? '' :
sprintf('%02d', $time['minute'])),
If you want to get pedantic passing nothing ('') rather than null (as
above) is also more technically correct isn't it?
$this->_selectOptions($minutes, ($time['minute'] === null) ? null :
sprintf('%02d', $time['minute'])),
But hours are not:
$this->_selectOptions($hours, sprintf('%02d', ($time['hour'] === null)
? null : $time['hour'])),
State ⇒ Resolved
Priority ⇒ 2. Medium
Type ⇒ Bug
Summary ⇒ hourminutesecond form incorrectly shows '00' selected for blank dates
Queue ⇒ Horde Framework Packages
State ⇒ Unconfirmed
variables one would expect the inputs to appear with 2 drop downs, one
with 'hh' selected, and the other 'mm'.
This isn't the case - '00' shows in both dropdowns.
Around line 362 of UI/VarRenderer/html.php we see this:
$html = sprintf('<select name="%s[hour]" id="%s[hour]"%s>%s</select>',
$varname,
$varname,
$this->_selectOptions($hours, sprintf('%02d',
$time['hour'])),
$this->_getActionScripts($form, $var));
The sprintf of $time['hour'] is causing a blank value of hour to be
converted to '00' and hence 'hh' (represented in the dropdown by
blank) is never shown).
Minutes are affected in the same way.