react-native 判断传入的日期是否是昨天
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(), '------') }