Elseine
Elseine

Reputation: 761

Setting a concrete date to start the datepicker

I am doing a calendar with Jquery Datepicker and I have to set the initial date in '1/1/2013'. That means that the first date that shows the datepicker must be that. I have tried that:

 $(function() {
   $('#datepicker').datepicker({minDate: '01/1/2013'})
 });

But I dont obtain what I am searching for. I am reading in this page and I found another example:

$(function() {
   var date = new Date(); // replace with your date
   $('#datepicker').datepicker().val(date.asString()).trigger('change');
});

But it doesnt work.

If anyone can help me, I will be very pleased

Upvotes: 1

Views: 130

Answers (1)

palaѕн
palaѕн

Reputation: 73896

Try this:

$('#datepicker').datepicker("setDate", new Date(2013,00,01));

FIDDLE

Upvotes: 1

Related Questions