Bootstrap DatePicker,如何设置明天的开始日期? [英] Bootstrap DatePicker, how to set the start date for tomorrow?

查看:73
本文介绍了Bootstrap DatePicker,如何设置明天的开始日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何设置明天的startDate?我在Date.today的文档中看不到任何选项,因此我可以再增加一天.

How can I set the startDate for tomorrow? I don't see an option in the documentation for Date.today so I can add one more day.

有没有办法做到这一点?

Is there a way to accomplish this?

$(function() {
    $("#appointment_adate").datepicker({
        format: 'yyyy-mm-d',
        autoclose: true,
        startDate: '+1d'    
    });
});

推荐答案

没有用于引导程序的官方日期选择器;因此,您应该明确说明您使用的是哪一个.

There is no official datepicker for bootstrap; as such, you should explicitly state which one you're using.

如果您使用的是 eternicode/bootstrap-datepicker ,则有一个选项"部分下讨论的那样:

If you're using eternicode/bootstrap-datepicker, there's a startDate option. As discussed directly under the Options section in the README:

所有带有"Date"的选项都可以处理Date对象.根据给定格式格式化的String; 或相对于今天的时间间隔,例如"-1d","+ 6m + 1y"等,其中有效单位为"d"(天),"w"(周),"m" (月)和"y"(年).

All options that take a "Date" can handle a Date object; a String formatted according to the given format; or a timedelta relative to today, eg '-1d', '+6m +1y', etc, where valid units are 'd' (day), 'w' (week), 'm' (month), and 'y' (year).

所以您会这样做:

$('#datepicker').datepicker({
    startDate: '+1d'
})

这篇关于Bootstrap DatePicker,如何设置明天的开始日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆