HTML_QuickForm_Date display before 1969
| From: | Sarah Gray | Date: | Mon, 17 Jan 2005 22:37:43 +0000 |
| Subject: | HTML_QuickForm_Date display before 1969 | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-16972@lists.php.net to get a copy of this message | ||
Hi,
Weird (to me) behaviour. I'm a little stuck on it.
I have a date dropdown menu that displays the correct date *unless* the
date falls before unix epoch begins (12-31-1969). No matter what the
date is, if the date falls before 12-31-69, my date dropdown menu
displays 31-Dec-1969 .
If the date is more recent than 1969, the dropdowns display the date
correctly.
No matter what the date is, the form submits it correctly to the
database -- it is an error only in displaying dates pre-1969 -- ie, you
can pull the dropdowns down to whatever date you wish, and it will do
the inserts correctly, as well as retrieve the data correctly when you
echo it to the page.
It's like the date is drawn before the menu knows it can display earlier
dates. I tried setting this in my php page as well as in
postGenerateForm, but it was the same either way. I feel I must be
missing something obvious, but I am still missing it. Does anyone have
a suggestion that would stop this?
Code snippet:
function postGenerateForm(&$form){
// removed so I could create a new element with minYear and maxYear
$form->removeElement('DOB');
$options = array('minYear'=>1924,
'maxYear'=>1990,
'addEmptyOption'=>true,
'format'=>'dMY');
$QF_date = new HTML_QuickForm_date('DOB', 'Date of Birth',$options);
$QF_date->setValue($this->DOB); // the date from the db, formatted
1969-02-14
$form->addElement($QF_date);
}
Thanks -- Sarah