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 #2226

Values for Date fields nonpadded?

Details

Submitted2004-08-26 21:52 UTC
Fromveeeee at gmail dot com
StatusWont fix
PackageHTML_QuickForm
PHP Version4.3.8
OSLinux
Roadmaps(Not assigned)

Comments

[2004-08-26 21:52 UTC] veeeee at gmail dot com

Description:
------------
While the options for the date select fields display correctly padded, the actual values are not, why?

<option value="1">01</option>
<option value="2">02</option>
<option value="3">03</option>

using version 3.2.3

Expected result:
----------------
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>

[2004-08-27 02:40 UTC] veeeee at gmail dot com

+++ PEAR/HTML/QuickForm/date.php 27 Aug 2004 02:38:46 -0000
@@ -368,7 +368,8 @@
function _createOptionList($start, $end, $step = 1)
{
for ($i = $start, $options = array(); $start > $end? $i >= $end: $i <= $end; $i += $step) {
- $options[$i] = sprintf('%02d', $i);
+ $o = sprintf('%02d', $i);
+ $options[$o] = $o;
}

[2004-08-27 07:48 UTC] bmansion at mamasam dot com

I don't see any added value in doing this.
The returned value is the month/day number, not its human readable representation, which is much more logical in my opinion.

[2004-08-27 12:04 UTC] veeeee at gmail dot com

The dates are padded in my datasource so comparisons would fail otherwise. Having the values returned by the form padded as well prevents me from needing to create workarounds in order to do accurate comparisons.

[2004-08-27 12:11 UTC] veeeee at gmail dot com

I should have also noted that if I have been using ADODB's DBTimeStamp() function to parse the input into the appropriate format for the datasource and if I feed it unpadded input it gives me an unpadded result.

[2004-08-27 14:40 UTC] veeeee at gmail dot com

I went ahead and added the workarounds to my code so that I no longer need to rely on input given in a consistent format.

Thanks.