Bootstrap DateTimePicker选择月份BUG

今天碰到的一个新问题:

当前月份为7月份.Bootstrap DateTimePicker在选择月份时,发现6月份为禁用,但是本地并没做任何限制,所以百度了下,知乎出现了解决方案:

详见地址:https://www.zhihu.com/question/39414586

引用原答案:

这样修改不能解决根本问题。

var months = this.picker.find('.datetimepicker-months') .find('th:eq(1)') .text(year) .end() .find('span').removeClass('active');

这种情况months得到的数组长度有时为12,有时为14(包含左右箭头符合)


711行左右修改为:

var months = this.picker.find('.datetimepicker-months').find('th:eq(1)').text(year).end().find('span.month').removeClass('active');

//这样得到的months数据始终是正确的。

if (currentYear == year) { // getUTCMonths() returns 0 based, and we need to select the next one months.eq(this.date.getUTCMonth()).addClass('active');}



作者:曾玲
链接:https://www.zhihu.com/question/39414586/answer/187519910
来源:知乎
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值