Bootstrap Datepicker:将开始日期更改为明天 [英] Bootstrap Datepicker : Changing start date to tomorrow

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

问题描述

我正在使用 Bootstrap datepicker ,以下是我的 jQuery code:

  $('。form_date')。datetimepicker({
language:'en' ,
/ * endDate:'+ 0d',* /
startDate:'+ 1d',
weekStart:1,
autoclose:1,
startView:2 ,
格式:'dd / mm / yyyy',
minView:2,
forceParse:0,
});

以下是我得到的:





我想要开始日期根据我们的要求突出明天。我在 Bootstrap datepicker 文档中找到一个选项 defaultViewDate 。 ( http://bootstrap-datepicker.readthedocs.org/en/latest/options .html



它表示我必须设置年份 $ 日键 defaultViewDate 。但是我不知道如何设置它。

解决方案

尝试以下;



{pre> $('。form_date')。datetimepicker({
defaultViewDate:{year:1977,month:04,day:25}
});

它应该是以年,月和日键为对象的格式。有关更多信息,请参见这里;



https: /eternicode.github.io/bootstrap-datepicker


I am using the Bootstrap datepicker and the following is my jQuery code:

$('.form_date').datetimepicker({
    language: 'en',
    /* endDate: '+0d', */
    startDate: '+1d',
    weekStart: 1,
    autoclose: 1,
    startView: 2,
    format: 'dd/mm/yyyy',
    minView: 2,
    forceParse: 0,
});

The following is what I get:

I want have the start date highlighting on tomorrow according to our requirement. I have found one option defaultViewDate on the Bootstrap datepicker documentation. (http://bootstrap-datepicker.readthedocs.org/en/latest/options.html)

It states that I have to set the year, month, and day key of defaultViewDate. But I don't know how to set it.

解决方案

Try following;

$('.form_date').datetimepicker({
    defaultViewDate: { year: 1977, month: 04, day: 25 }
});

It should be in the format of Object with year, month and day keys. For more information please see here;

https://eternicode.github.io/bootstrap-datepicker

这篇关于Bootstrap Datepicker:将开始日期更改为明天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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