Vue.filter('formatDateForTime', function(timestamp) {
if (timestamp === 0) {
return '---';
}
// timestamp = timestamp * 1000; // 将秒转换为毫秒
let date = new Date(timestamp);
let now = new Date()
let yesterday = new Date(date.getTime() + 1 * 3600 * 1000 * 24)
let thisWeek = new Date(date.getTime() + (now.getDay() - 1) * 3600 * 1000 * 24)
// let time=date.getTime()+(now.getDay() - 1)*3600*1000*24
if (date.getFullYear() == now.getFullYear() && date.getMonth() == now.getMonth() && date.getDate() == now
.getDate()) {
let hours = ("0" + date.getHours()).slice(-2)
let minute = ("0" + date.getMinutes()).slice(-2)
return `${hours}:${minute}`;
} else if (yesterday.g
vue 过滤器返回今天 昨天+时间 -月-日
最新推荐文章于 2023-12-15 15:25:49 发布