I am using the datepicker and it displays the correct date in it's window but the date object has the same date but with a month prior to the date actually selected. I can't see what I am doing wrong in the code. I tried using the object.setDate "+1m" to correct but probably don't know how to do this. Can anyone see what is wrong with my code that results in this.
$.datepicker.setDefaults({
beforeShow: function(input) {
$(input).css('background-color','#C5F5A2');
},
onSelect: function(dateText, obj) {
$(this).css('background-color','');
//$(this).datepicker( "setDate", "+1m" );
},
onClose: function(dateText, obj) {
var PassDate = obj.selectedYear+"-"+ obj.selectedMonth +"-"+ obj.selectedDay ;
// alert("\n\nMy New Pass Variable Date: "+ obj.selectedYear+"-"+ obj.selectedMonth +"-"+ obj.selectedDay) ;
//alert("PassDate varuable= " + PassDate );
$(this).css('background-color','');
$("#showPassDate").text(PassDate);//THIS IS WHAT PASSES THE DATE TO THE SP SERVICE via html SO MUST HAVE FOR NOW
// $( "#showPassDate" ).html( "<p><b>Meeting Date: </b></p>" + PassDate );//THIS IS WHAT PASSES THE DATE TO THE SP SERVICE via html SO MUST HAVE FOR NOW
$("#xCalendarTable2").show();
// NEED METHOD TO TAKE ITEM OFF AGENDA SET DATE TO BLANK
},
showOn: 'button',
buttonText:'Show Date',
dateFormat: 'DD, d MM, yy',//
//dateFormat: 'yyyy-MM-DD',//
buttonImage:'https://myWebSite/sites/localresearch/JQUERY/img-Calendar.png',
numberOfMonths: 3,
showButtonPanel: true,
constrainInput: true,
autoSize: true,
//defaultDate: null
duration: 'fast',
goToCurrent: false,
minDate: '-0', // The min date that can be selected, i.e. 30 days from the 'now'
maxDate: '+2m +1w +1d', // The max date that can be selected, i.e. + 1 month, 1 week, and 1 days from 'now'
altField: '#alternate',
altFormat: 'DD, d MM, yy'
});
$(function() { //CODE TO VARY CAL ANIMATION
$( "#datepicker" ).datepicker();
$( "#datepicker" ).datepicker( "option", "showAnim", "blind" ); //CANT PUT THIS IN INSTANTIATION LIST
$(".ui-datepicker-trigger").mouseover(function() {
$(this).css('cursor', 'pointer');
});//END MOUSEOVER doesnt work needs to be part of datepicker function
});