const isYesterday=(theDate='2022-1-1 10:12:00')=>{ theDate = new Date(theDate) var date = (new Date()); //当前时间 var today = new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime(); //今天凌晨 var yestday = new Date(today - 24*3600*1000).getTime(); if(theDate.getTime() < today && yestday <= theDate.getTime()){ return true }else{ return false } // console.log(theDate.getTime() < today && yestday <= theDate.getTime(), '------') }
标签:getTime,是否是,var,react,Date,theDate,date,new,native From: https://www.cnblogs.com/tlfe/p/16727742.html