Strange calendar widget behavior.
Posted: Sun Jul 24, 2011 3:57 pm
I have 3 date fields in my database, which I want to show in mm/dd/yyyy format. As recommended in other posts, I have added functions to the file's delegate class:
and now the date displays as I wish. When first entering a date with the calendar widget it displays as yyyy-mm-dd, but after pressing "Save" it displays correctly. This I can live with. (I've tried using widget:ifFormat = "%m/%d/%Y", but his doesn't seem to make any difference).
However, the odd thing is that when the date field has an existing value of, say, 9/22/2009, when I click on the calendar icon it opens up at 31st March 2016!
Any idea what's going on?
Thanks.
- Code: Select all
function adoption_date__display(&$record){
return date('m/d/Y', strtotime($record->strval('adoption_date')));
}
function adoption_date__pullValue(&$record, $element){
return date('m/d/Y', strtotime($record->strval('adoption_date')));
}
and now the date displays as I wish. When first entering a date with the calendar widget it displays as yyyy-mm-dd, but after pressing "Save" it displays correctly. This I can live with. (I've tried using widget:ifFormat = "%m/%d/%Y", but his doesn't seem to make any difference).
However, the odd thing is that when the date field has an existing value of, say, 9/22/2009, when I click on the calendar icon it opens up at 31st March 2016!
Any idea what's going on?
Thanks.