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 发布
本文介绍了一种出借时间的展示方法,通过解析日期并根据是否为当天决定展示格式。如果时间为当天,则显示“今天”加上具体时间;如果不是当天,则直接显示日期。
1070

被折叠的 条评论
为什么被折叠?



