jquery日期选择器

sup*_*iya 1 javascript jquery jquery-ui ruby-on-rails datepicker

我使用jQuery的日期选取器在轨项目,我想禁用previous/ past日期.

有没有办法实现这一目标.以及如果减去当前的时间

Hai*_*vgi 5

禁用直到今天的所有日期:

// get the current date
var date = new Date();
var m = date.getMonth(), d = date.getDate(), y = date.getFullYear();

// Disable all dates till today
$('#datepicker2').datepicker({
        minDate: new Date(y, m, d),
        dateFormat: 'mm-dd-yy',
});
Run Code Online (Sandbox Code Playgroud)

在这篇文章中看到更多好的选择