Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.2

Bug #8105 Add support for 'g' date element format option
Submitted: 2006-07-03 07:12 UTC
From: dsanders at baselinesolutions dot com dot au Assigned: justinpatrin
Status: Closed Package: DB_DataObject_FormBuilder (version 1.0.0RC5)
PHP Version: 4.3.10 OS: FC2
Roadmaps: (Not assigned)    
Subscription  


 [2006-07-03 07:12 UTC] dsanders at baselinesolutions dot com dot au (David Sanders)
Description: ------------ It'd great to just add the 'g' QuickForm date element format option to _date2array() and _array2date(). (The 'g' is 'h' without any leading zeroes) Should be simple enough :) (See bug #3733)

Comments

 [2006-12-07 06:44 UTC] dsanders at baselinesolutions dot com dot au
Ok lazy bones here's a patch ;) @@ -2460,6 +2460,7 @@ class DB_DataObject_FormBuilder if ($da['h'] == 0) { $da['h'] = 12; } + $da['g'] = $da['h']; $da['i'] = $dObj->getMinute(); $da['s'] = $dObj->getSecond(); if ($da['H'] >= 12) { @@ -2482,6 +2483,7 @@ class DB_DataObject_FormBuilder $da['Y'] = $da['y'] = date('Y', $time); $da['H'] = date('H', $time); $da['h'] = date('h', $time); + $da['g'] = date('g', $time); $da['i'] = date('i', $time); $da['s'] = date('s', $time); $da['a'] = date('a', $time); @@ -2525,8 +2527,12 @@ class DB_DataObject_FormBuilder } if (isset($dateInput['H'])) { $hour = $dateInput['H']; - } elseif (isset($dateInput['h'])) { - $hour = $dateInput['h']; + } elseif (isset($dateInput['h']) || isset($dateInput['g'])) { + if (isset($dateInput['h'])) { + $hour = $dateInput['h']; + } elseif (isset($dateInput['g'])) { + $hour = $dateInput['g']; + } if (isset($dateInput['a'])) { $ampm = $dateInput['a']; } elseif (isset($dateInput['A'])) { Now the g in _date2array() isn't strictly necessary because HTML_QuickForm_date::setValue() creates everything from a call to date() anyway.
 [2006-12-07 07:04 UTC] dsanders at baselinesolutions dot com dot au
Changed from request to bug as this might catch other people out...
 [2006-12-07 07:21 UTC] justinpatrin (Justin Patrin)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. Sorry it took so long to fix, thanks for the patch.