timeDownItem = ()=> {
/**
* 出借时间
* @type {any}
*/
let investTime = this.parseDate(this.props.data.time).getTime();
let subInvestTime=this.props.data.time.substring(11,16);
let investDate=this.props.data.time.substring(0,10);
let d = new Date(this.props.data.time);
let that = this;
if(d.toDateString() === new Date().toDateString()){
that.setState({
investTime: '今天 '+subInvestTime,
})
} else {
that.setState({
investTime: investDate,
})
}
};
以上代码示例显示出借时间,如果是当天显示今天:xx:xx;
js判断当前时间戳是不是今天
最新推荐文章于 2024-05-22 10:07:07 发布