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

date element chokes on '0000-00-00'

Details

Submitted2005-01-29 03:09 UTC
Froms2 at schramfam dot com
StatusWont fix
PackageHTML_QuickForm
PHP Version4.3.10
OSWindows XP
Roadmaps(Not assigned)

Comments

[2005-01-29 03:09 UTC] s2 at schramfam dot com

Description:
------------
HTML_QuickForm ver. 3.2.4pl1
HTML_QuickForm_date::setValue doesn't like the MySQL default date '0000-00-00'. It results in Nov 30, 1999. I think strtotime is the culprit.

Reproduce code:
---------------
function setValue($value)
{
if (empty($value) || $value='0000-00-00') {
$value = array();
}
...

Above code fixes it, but I'm not sure that it is the best method.

[2005-01-30 23:38 UTC] s2 at schramfam dot com

From the MySQL documentation:
Illegal DATETIME, DATE, or TIMESTAMP values are converted to the ``zero'' value of the appropriate type ('0000-00-00 00:00:00', '0000-00-00', or 00000000000000).

So, it is a valid date. If you think I ought to use another product, what product will eliminate the need for a "empty" or "invalid" date representation? None, I think. Perhaps you should think through your comments before you trash those who are trying to help you improve your product.