Iam using ZendX_JQuery_Form_Element_DatePicker, I want to set the a default date to the date time picker.
My current code is this -
$date = new ZendX_JQuery_Form_Element_DatePicker('date',
array('jQueryParams' => array('defaultDate' => date('Y-m-D'),
'changeYear'=> 'true')));
$date->setJQueryParam('dateFormat', 'dd.mm.yy')
->setRequired()
->setLabel("Date");
This returns the date as August 2016 on the calender. Iam not sure what am doing wrong. Can someone suggest here the code for getting the correct server date.
I would recommend considering using JQuery without ZendX_JQuery (if possible). The reason is that currently there is discussion about Discontinuing Maintenance of ZendX JQuery - Suggest drop for 2.0.
If you do not use ZendX_JQuery, then the default date could be set during construction of your Zend_From. For example:
Then in your view, you could add:
Nevertheless, returning to your code I think the
defaultDate
should be in the currentdateFormat
(from datepicker doc). In your code, it is not, so this may be one reason it does not work properly.