比赛日期优化
This commit is contained in:
@@ -197,18 +197,19 @@ export class UserService {
|
||||
const weekdays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
|
||||
|
||||
const start_date = new Date(start_time.getFullYear(), start_time.getMonth() + 1, start_time.getDate());
|
||||
const weekday = weekdays[start_time.getDay()];
|
||||
|
||||
let date_str = '';
|
||||
if (start_date.getTime() === today.getTime()) {
|
||||
date_str = '今天';
|
||||
} else if (start_date.getTime() === tomorrow.getTime()) {
|
||||
date_str = '明天';
|
||||
date_str = `明天(${weekday})`;
|
||||
} else if (start_date.getTime() === day_after_tomorrow.getTime()) {
|
||||
date_str = '后天';
|
||||
date_str = `后天(${weekday})`;
|
||||
} else if(this.is_date_in_this_week(start_time)) {
|
||||
date_str = weekdays[start_time.getDay()];
|
||||
date_str = weekday;
|
||||
} else {
|
||||
date_str = `${start_time.getFullYear()}-${(start_time.getMonth() + 1).toString().padStart(2, '0')}-${start_time.getDate().toString().padStart(2, '0')}`;
|
||||
date_str = `${start_time.getFullYear()}-${(start_time.getMonth() + 1).toString().padStart(2, '0')}-${start_time.getDate().toString().padStart(2, '0')}(${weekday})`;
|
||||
}
|
||||
|
||||
const time_str = `${start_time.getHours().toString().padStart(2, '0')}:${start_time.getMinutes().toString().padStart(2, '0')}`;
|
||||
|
||||
Reference in New Issue
Block a user