I am currently using the JQuery plugin Datepicker in my Symfony project with the sfFormExtraPlugin. Everything is working fine but there is a seems to be a strange bug in the plugin. If I select 8 or 9 in any month the day is not selected in the form. The month and year work correctly but the day is not selected. The plugin works correctly for all other days but not for those two days.
The date format that I use is day/month/year. Not sure if thats part of the problem.
Thanks!
Here is the code I use to initialize the widget:
$years = range(date('Y'), date('Y')-80);
$this->widgetSchema['fecha_nacimiento'] = new sfWidgetFormJQueryDate(array(
'image'=>'/images/calendario.jpg',
'culture' => 'es',
'date_widget' => new sfWidgetFormDate(array('format'=>'%day%/%month%/%year%',
'years' => array_combine($years, $years)))
)
);
I should also mention that other people have told me they had the same problem. It seems to be a problem with the plugin but am not sure.
The problem as Pointy points out is a parseInt() call. It is actually not one parseInt() call but three. As he also points out the datePicker works fine. The problem is inside the symfony plugin sfFormExtraPlugin. When it interfaces with the datePicker jQuery library there are three parseInt() calls that lack the necessary argument to indicate that they are decimal. The bug is actually quite easy to fix. In a typical installation you should find it in sfFormExtraPlugin/lib/widget/sfWidgetFormJQueryDate.class.php .
Then search for parseInt and the triplet is one of the first to appear. You only have to check that it follows the following structure: parseInt(arg, 10) (the important part is the ,10.
Thanks to Pointy for the inspiration.