elementUI moment 年月日转时间戳 时间限制

复制代码
      changeStartTime(val){
        debugger
        this.startT = val
        // this.startTime = parseInt(val.split('-').join(''))
        this.startTime = moment(val).unix() * 1000 //开始时间毫秒
        if(this.endTime){
          this.endTime = moment(this.endT).unix() * 1000 //结束时间毫秒
          if(this.startTime - this.endTime >= 0){
            this.$message.warning('培训开始时间不能大于培训结束时间!')
            this.form.trainTime = ''
            this.form.trainDuration = ''
          }else{
            const sc = (this.endTime - this.startTime) /1000 / 60 / 60 + 'h'
            this.form.trainDuration = sc
          }
        }
      },
      changeEndTime(val){
        this.endT = val
        // this.endTime = parseInt(val.split('-').join(''))
        this.endTime = moment(val).unix() * 1000 //开始时间毫秒
        if(this.startTime){
          this.startTime = moment(this.startT).unix() * 1000 //结束时间毫秒
          if(this.endTime - this.startTime <=0 ){
            this.$message.warning('培训结束时间不能小于培训开始时间!')
            this.form.completeTime = ''
            this.form.trainDuration = ''
          }else{
            const sc = (this.endTime - this.startTime) /1000 / 60 / 60 + 'h'
            this.form.trainDuration = sc
          }
        }
      },
相关推荐
CHANG_THE_WORLD12 分钟前
PDF文档结构分析 一
前端·pdf
2601_9498333923 分钟前
flutter_for_openharmony口腔护理app实战+知识实现
android·javascript·flutter
东东51628 分钟前
果园预售系统的设计与实现spingboot+vue
前端·javascript·vue.js·spring boot·个人开发
rainbow688929 分钟前
Python学生管理系统:JSON持久化实战
java·前端·python
打小就很皮...33 分钟前
React Router 7 全局路由保护
前端·react.js·router
起风的蛋挞42 分钟前
Matlab提示词语法
前端·javascript·matlab
有味道的男人43 分钟前
1688获得商品类目调取商品榜单
java·前端·spring
txwtech1 小时前
第20篇esp32s3小智设置横屏
前端·html
Exquisite.1 小时前
企业高性能web服务器---Nginx(2)
服务器·前端·nginx
DFT计算杂谈1 小时前
VASP+PHONOPY+pypolymlpj计算不同温度下声子谱,附批处理脚本
java·前端·数据库·人工智能·python