0

Hello I have a problem with the data picker form jQuery. The following code ignores the mindate

$('#datefrom').datepicker({
    minDate: '26.04.2013',
    setDate: +0,
    dateFormat: 'dd.mm.yy',
    onSelect: function(dateStr) {
        var date = $(this).datepicker('getDate');
        if (date) {
              date.setDate(date.getDate() + 1);
        }
        $('#dateto').datepicker("setDate", date);
    }
});             
$('#dateto').datepicker({               
    minDate: '27.04.2013',
    setDate: +0,
    dateFormat: 'dd.mm.yy'
});
$("#datefrom").datepicker().change(function() {
    var date = $(this).datepicker('getDate');
    if (date) {
          date.setDate(date.getDate() + 1);
    }
    $('#dateto').datepicker("setDate", date);
});
$("#datefrom").datepicker('setDate', 'today');
$("#dateto").datepicker('setDate', +1);         

To do have any idea what i could do?

7

2 Answers 2

0

minDate wants a Date-object http://api.jqueryui.com/datepicker/#option-minDate

$( ".selector" ).datepicker({ minDate: new Date(2007, 1 - 1, 1) });

this works for me: http://jsfiddle.net/JVueL/

1
  • show me your code in a way that I don't have to look for it half an our! Meaning, show the important code-snippet as edit. Because, as you can see in jsfiddle, my code works
    – El Hocko
    Feb 18, 2013 at 15:02
-2

It must be a number, like 1, 15, 30. -1 - is yesterday 0 - is today, 1 - is tomorrow

1
  • i need to set a specific date
    – jswolf
    Feb 15, 2013 at 13:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.