getdate() {
var now = new Date(),
y = now.getFullYear(),
m = now.getMonth() + 1,
d = now.getDate();
return y + "-" + (m < 10 ? "0" + m : m) + "-" + (d < 10 ? "0" + d : d) + " " + now.toTimeString().substr(0, 8);
}
compareTime(time) {
let now = new Date(); //当前时间
//如果传2022-02-22 14:15:00要转化成 2022/02/22 14:15:00
let startTime = time;
let end = new Date(startTime.replace(/-/g, '/')); //对比时间
if (now.getTime() > end.getTime()) {
//当前时间比指定时间大
return false;
} else {
//小于指定时间
return true;
}
},