I am using a CJuiDatePicker on a form to store a date of birth. However when the date of birth is unknown a null value is returned from the database. When i load the form the CJuiDatePicker widget displays 01-01-1970. How do i get this to display nothing in the field??
Having the same problem but in a different view, I believe.
I have the datepicker on create/update forms, with the "date" field being optional. At creation, when the "date" is left NULL, it shows as NULL in the DB. However, when I try to update that record, the datepicker shows "0000-00-00" for some reason and I cannot override the default value.
Can anyone help?
Thank you!
EDIT:
Right after posting, I figured it out:
if (!$model->isNewRecord && $model->date=="0000-00-00"){
$model->date="";
}
This will set the "date" field to empty if it returns "0000-00-00" from DB. Hope this helps someone.