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.
JavaScript Date objects represent a single moment in time in a platform-independent format. Date objects encapsulate an integral number that represents milliseconds since the midnight at the beginning of January 1, 1970, UTC (the epoch).
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…
system
Closed
March 3, 2016, 7:17am
5
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.