在Bootstrap DateTimePicker中将minDate设置为Today

编程入门 行业动态 更新时间:2024-10-27 20:36:06
本文介绍了在Bootstrap DateTimePicker中将minDate设置为Today的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用Bootstrap DateTime Picker( eonasdan.github.io/bootstrap-datetimepicker /),我已经找到了设置minDate的基本选项;但是,为了挽救生命,我无法将其设置为今天.我已经尝试过类似Date()的事情;但是,没有任何效果.有人有什么想法吗?

I'm using Bootstrap DateTime Picker (eonasdan.github.io/bootstrap-datetimepicker/) and I've found the basic option to set a minDate; but, I can't get it to set to today to save my life. I've tried things like Date(); but, nothing working. Anyone have any ideas?

示例

$('#date').datetimepicker({ pickTime: false, icons: { time: "fa fa-clock-o", date: "fa fa-calendar", up: "fa fa-arrow-up", down: "fa fa-arrow-down" }, startDate: new Date() });

推荐答案

如果使用的是最新版本,则需要设置minDate选项.这是一个 JSFiddle 以及一个有效的示例.希望这会有所帮助.

If you're using the latest version, the minDate option is what you'll need to set. Here is a JSFiddle with a working example. Hope this helps.

$('#date').datetimepicker({ pickTime: false, icons: { time: "fa fa-clock-o", date: "fa fa-calendar", up: "fa fa-arrow-up", down: "fa fa-arrow-down" }, minDate: moment() });

更多推荐

在Bootstrap DateTimePicker中将minDate设置为Today

本文发布于:2023-10-16 11:22:57,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1497416.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:设置为   中将   DateTimePicker   Bootstrap   minDate

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!