jQuery Datepicker - Month showing one month later than set. WUTt?

Pre-setting a date in the DatePicker. d
However, for the below (and other daytes I’ve tried), the selected date shows as one month LATER that what I’ve got set. So in this case “06/15/2016” is showing as the set date.

What the heck do I have wrong?

$(document).ready(function() { $( "#dep_date" ).datepicker({ yearRange: "-0:+1" }); $("#dep_date").datepicker("setDate", new Date(2016,10,15)); });

Months in JavaScript are offset by -1.

month
Integer value representing the month, beginning with 0 for January to 11 for December.

1 Like

Thanks!
So, grab the date from the database, format it minus one month for the DatePicker…
As if dealing with dates in PHP isn’t difficult enough…

plus 1

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.