0

JQuery UI datepicker widget is not displaying the date correctly it looks like this:

the input code looks like this:

<input type="text" value="" name="DateTo" id="DateTo" class="hasDatepicker">

I add datepicker simply by calling $('#DateTo').datepicker();

Anyone have an idea why it does not display the dates correctly?

4

1 回答 1

3

set the dates:

var qDates = '2009-11-01',
dateParts = qDates.match(/(\d+)/g)
realDate = new Date(dateParts[0], dateParts[1] - 1, dateParts[2]);  

$('#datePicker').datepicker({ dateFormat: 'yy-mm-dd' }); 
$('#datePicker').datepicker('setDate', realDate);
于 2013-03-31T00:16:38.627 回答