PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTML » HTML_QuickForm » Bug #7123

handling of empty dates in HTML_QuickForm_Date

Details

Request #7123handling of empty dates in HTML_QuickForm_Date
Submitted2006-03-14 23:27 UTC
Fromdemental at free dot fr
Assignedavb
StatusClosed
PackageHTML_QuickForm
PHP VersionIrrelevant
OSany OS
Roadmaps(Not assigned)

Comments

[2006-03-14 23:27 UTC] demental at free dot fr

Description:
------------
Whenever you have a date field, which is not required in a
form, I did not find a way to handle this.
So the solution can be to extend HTML_QuickForm_Date and
override _createOptionList.
I send the patched version of this method. What do you think
about it ?

Test script:
---------------
function _createOptionList($start, $end, $step = 1)
{
$options = array();
if($start>0) {
$nbdash = strlen(sprintf('%02d', $end));
$options[''] = str_repeat('-',$nbdash);
}
for ($i = $start; $start > $end? $i >= $end: $i <= $end; $i += $step) {
$options[$i] = sprintf('%02d', $i);
}
return $options;
}