zoukankan      html  css  js  c++  java
  • vue el 自动计算时间加1天

    /** 计算结束时间方法**/
                effectiveEndTimeHander(value){
                    const year1 = 8*365;
                    //注册日期+延保产品服务年限8
                    this.formOrder.effectiveEndTime=this.formCar.regDate;
    
                    let tomorrow = new Date(value);
                    let nowDate = this.getNowFormatDate();
                    tomorrow.setTime(tomorrow.getTime() + 24 * 60 * 60 * 1000);
                    let reduce = '-';
                    let year = tomorrow.getFullYear() + reduce + this.addZero(tomorrow.getMonth() + 1) + reduce + this.addZero(tomorrow.getDate());
    
                    let t_timestamp = Math.round(new Date(year) / 1000);
                    let n_timestamp = Math.round(new Date(nowDate) / 1000);
    
                    if(t_timestamp > n_timestamp){
                        return this.msgError('不能超过今天');
                    }else{
                        this.formOrder.effectiveEndTime = year;
                    }
                },
                getNowFormatDate: function () {
                    let date = new Date();
                    let reduce = "-";
                    let currentdate = date.getFullYear() + reduce + this.addZero(date.getMonth() + 1) + reduce + this.addZero(date.getDate());
                    return currentdate;
                },
                addZero: function (time) {
                    if (time >= 1 && time <= 9) {
                        time = "0" + time;
                    }
                    return time;
                },
    

      

  • 相关阅读:
    python web 2
    python web1(解析url)
    webstrom 今天突然要激活
    数组排序 记录一下
    浏览器添加随机数去除缓存
    vue-cli 安装报错
    vue 初始化项目报错
    深拷贝和浅拷贝
    css3 属性 clip-path
    js数组去重
  • 原文地址:https://www.cnblogs.com/gzhbk/p/15157701.html
Copyright © 2011-2022 走看看