| | |
| | | this.queryParam.endTime = '' |
| | | } else { |
| | | //后端报这个错rejected value ["2024-03-14T06:26:38.692Z"] |
| | | this.queryParam.beginTime = this.ranges[0].format('YYYY-MM-DD') |
| | | this.queryParam.endTime = this.ranges[1].format('YYYY-MM-DD') |
| | | // var beginTime = this.formattedTime(this.ranges[0]) |
| | | // this.queryParam.beginTime = this.ranges[0].format('YYYY-MM-DD') |
| | | // this.queryParam.endTime = this.ranges[1].format('YYYY-MM-DD') |
| | | this.queryParam.beginTime = this.formattedTime(this.ranges[0]) |
| | | this.queryParam.endTime = this.formattedTime(this.ranges[1]) |
| | | } |
| | | }, |
| | | |
| | | formattedTime(originalTime) { |
| | | |
| | | // 创建 Date 对象 |
| | | const date = new Date(originalTime) |
| | | |
| | | // 检查 Date 对象是否有效 |
| | | if (isNaN(date.getTime())) return '无效时间' |
| | | |
| | | // 获取年、月、日、时、分 |
| | | const year = date.getFullYear() |
| | | const month = String(date.getMonth() + 1).padStart(2, '0') |
| | | const day = String(date.getDate()).padStart(2, '0') |
| | | const hours = String(date.getHours()).padStart(2, '0') |
| | | const minutes = String(date.getMinutes()).padStart(2, '0') |
| | | const seconds = String(date.getSeconds()).padStart(2, '0') |
| | | // 拼接成指定格式 |
| | | return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}` |
| | | }, |
| | | |
| | | } |
| | | } |
| | | </script> |