6.0.0-alpha14
6/25/25

[#3218] hourminutesecond form incorrectly shows '00' selected for blank dates
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

History
01/08/2006 12:08:11 AM Chuck Hagenbuch Comment #6
State ⇒ Resolved
Reply to this comment
Should be set now.
01/07/2006 04:42:53 PM Chuck Hagenbuch Comment #5 Reply to this comment
Checking for empty values is a better option:
No, it really isn't - that way if you set the default to 5:00am, it'd 
show up as 5 mm.
01/07/2006 12:31:02 PM Jan Schneider Assigned to Chuck Hagenbuch
State ⇒ Assigned
 
01/07/2006 10:01:32 AM robin (at) rainton (dot) com Comment #4 Reply to this comment
Ah, actually, by just checking for null this doesn't work on a 
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?
01/07/2006 09:20:47 AM robin (at) rainton (dot) com Comment #3 Reply to this comment
Should be fixed in CVS.
Thx for the quick turn round. Minutes are fixed:



$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'])),
01/07/2006 04:56:14 AM Chuck Hagenbuch Comment #2
State ⇒ Resolved
Reply to this comment
Should be fixed in CVS.
01/04/2006 10:36:23 AM robin (at) rainton (dot) com Comment #1
Priority ⇒ 2. Medium
Type ⇒ Bug
Summary ⇒ hourminutesecond form incorrectly shows '00' selected for blank dates
Queue ⇒ Horde Framework Packages
State ⇒ Unconfirmed
Reply to this comment
If one simply creates an hourminutesecond input, but does not assign 
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.

Saved Queries