直播app开发搭建,js对时间日期判断今天昨天明天
let time = function(date) {
let time_str = "";
if (new Date(date).getDate() === new Date().getDate()) {
time_str = "今天";
} else if (new Date(date).getDate() === (new Date().getDate() - 1)) {
time_str = "昨天";
} else if (new Date(date).getDate() === (new Date().getDate() + 1)) {
time_str = "明天";
} else if (new Date(date).getDate() < new Date().getDate()) {
time_str = "过去";
}
return time_str;
}
以上就是 直播app开发搭建,js对时间日期判断今天昨天明天,更多内容欢迎关注之后的文章
标签:app,js,date,直播,str,time,Date,new,getDate From: https://www.cnblogs.com/yunbaomengnan/p/17126611.html