Datepicker Startdate /defaultdate

Hi Having searched and found no relevant answer, I am needing to know whether the datepicker has a fix that can be applied so that the selected date can be set on display of the form, it’s no good me displaying a form to edit details and not being able to set the datepickers startdate (selected date).


Sorry, to elaborate, I pass a week-commencing date to the form and receive it using a $_GET call and from here can set the minimum date to the week commencing date and the max date to +6 days, but what I need to do is set the day selected to be the first day of the week (the Monday of the week_commencing) and when adjusting a date, I need the day to be selected already when the user is faced with the picker so if the day is the fourteenth, then i need that selected so that if they don’t change it then it stays the same!


Are you using Jquery datepicker ?

If you are using it. datepicker will auto handle value attribute of the input form to get the selected date when update.

For the first date of week,You can try this

   $('#selector').datepicker('option', 'firstDay', date_of_week);

date_of_week in [1,7] where sunday =1

Easy, without js function and just using php code:


	'firstDay'=> 1,  //1: Monday