0wl
0wl

Reputation: 688

Strange jquery ui datepicker behavior

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?

Upvotes: 0

Views: 440

Answers (1)

Jorge Y. C. Rodriguez
Jorge Y. C. Rodriguez

Reputation: 3449

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);

Upvotes: 3

Related Questions