赞
踩
date可以为任何日期
if (new Date(date).getDate() === new Date().getDate()) {
this.time_str = "今天";
} else if (new Date(date).getDate() === (new Date().getDate() - 1)) {
this.time_str = "昨天";
} else if (new Date(date).getDate() === (new Date().getDate() + 1)) {
this.time_str = "明天";
} else if (new Date(date).getDate() < new Date().getDate()) {
this.time_str = "过去";
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。