使用jQuery Datepicker進入一個奇怪的問題。我已設置選項changeMonth:true以啓用月份更改。JQuery Datepicker日期僅在點擊該日期時被捕獲
說,如果我的日期選擇器顯示的日期2013年2月5日,當我剛剛一個月改爲四月(不點擊任何一天在控制),日期被顯示爲2013年2月4日。但是,當我從控制中得到日期時,我最終得到的是舊的月份值而不是新選擇的值。
代碼:
$('#uxStartDateTime').datetimepicker({
timeFormat: "hh:mm tt",
dateFormat: "dd/mm/yy",
showButtonPanel: false,
changeMonth: true,
changeYear: true
});
//getting the date
var startDate = $('#uxStartDateTime').datetimepicker('getDate');
//formatting this date to it send via ajax to c#
startDate = startDate.getFullYear() + "-" + (startDate.getMonth() + 1) + "-" + startDate.getDate() + " " + startDate.getHours() + ":" + startDate.getMinutes();
有什麼毛病我的方法還是這是一個已知的問題?
它應該是這樣的,你可以在幾個月之間來回滾動,但你必須實際選擇一個日期來改變日期,這是幾乎每個日期選擇器的工作方式! – adeneo 2013-05-14 16:29:10
@adeneo哦,我明白了。有沒有什麼方法可以克服這種行爲? – Devin 2013-05-14 16:35:34