zoukankan      html  css  js  c++  java
  • bootstrap中datetimepicker只选择月份显示1899问题

    直接修改bootstrap-datetimepicker.js中

    update: function () {
                var date, fromArgs = false;
                if (arguments && arguments.length && (typeof arguments[0] === 'string' || arguments[0] instanceof Date)) {
                    date = arguments[0];
                    fromArgs = true;
                } else {
                    //这里加了个判断,原来只有else部分,增加了对自定义格式的处理
                    if (this.element.val().length == 6) {
                        date = this.element.val().substring(0, 4) + "-" + this.element.val().substring(4, 6) + "-01";
                    } else {
                        date = (this.isInput ? this.element.val() : this.element.find('input').val()) || this.element.data('date') || this.initialDate;
                        if (typeof date == 'string' || date instanceof String) {
                            date = date.replace(/^s+|s+$/g, '');
                        }
                    }
                }
    
                if (!date) {
                    date = new Date();
                    fromArgs = false;
                }
    
                this.date = DPGlobal.parseDate(date, this.format, this.language, this.formatType);
    
                if (fromArgs) this.setValue();
    
                if (this.date < this.startDate) {
                    this.viewDate = new Date(this.startDate);
                } else if (this.date > this.endDate) {
                    this.viewDate = new Date(this.endDate);
                } else {
                    this.viewDate = new Date(this.date);
                }
                this.fill();
            }            
  • 相关阅读:
    使用Java发送qq邮件
    docker部署nacos1.4
    职责链模式
    策略模式
    状态模式
    解释器模式
    备忘录模式
    js中数组常用方法总结
    微信小程序生成二维码工具
    小程序登录过程
  • 原文地址:https://www.cnblogs.com/wpcnblog/p/5970314.html
Copyright © 2011-2022 走看看