Bootstrap DateTimePicker选择月份BUG

来源:互联网 发布:java 工程师 简历 编辑:程序博客网 时间:2024/05/18 21:38

今天碰到的一个新问题:

当前月份为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 onemonths.eq(this.date.getUTCMonth()).addClass('active');}



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

阅读全文
1 0