简体   繁体   English

jQuery日期选择器

[英]jquery date picker

I am using jquery date picker in rails project, I want to disable the previous/ past dates. 我在Rails项目中使用jQuery日期选择器 ,我想禁用 previous/ past日期。

Is there any way to achieve this. 有什么办法可以做到这一点。 as well as the time if less that current 以及时间(如果小于当前时间)

Disable all dates till today : 禁用直到今天的所有日期:

// 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',
});

see more good option in this post 在这篇文章中看到更多好的选择

Have you tried setting the minDate option to the current date? 您是否尝试过将minDate选项设置为当前日期?

http://jqueryui.com/demos/datepicker/#option-minDate http://jqueryui.com/demos/datepicker/#option-minDate

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM