-
首先我们获取到"2020-5-5"类型的值
通过Date函数转换 var inputDate = new Date(Date.parse(realTimeEnd)); -
获取当前时间,直接贴代码
var date = new Date(); var seperator1 = "-"; var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var currentdate = year + seperator1 + month + seperator1 + day;
-
变量currentdate 当前日期的字符串,下面直接转换类型比较
inputDate < (new Date(currentdate.replace(/-/g, "\/")))