mirror of
https://github.com/PlayEdu/h5.git
synced 2025-06-08 13:40:09 +08:00
最近学习时间错误优化
This commit is contained in:
parent
d6c5899da2
commit
aa54835a7b
@ -29,27 +29,21 @@ const StudyPage = () => {
|
||||
let box: CourseModel[] = [];
|
||||
if (data && data.length > 0) {
|
||||
data.map((item: any) => {
|
||||
if (
|
||||
item.hour_record &&
|
||||
moment(item.hour_record.updated_at).isSame(moment(), "day")
|
||||
) {
|
||||
let time = moment(item.hour_record.updated_at)
|
||||
.utcOffset(0)
|
||||
.format("YYYY-MM-DD HH:mm:ss");
|
||||
if (moment(time).isSame(moment(), "day")) {
|
||||
today.push(item);
|
||||
} else if (
|
||||
item.hour_record &&
|
||||
moment(item.hour_record.updated_at).isSame(
|
||||
moment().subtract(1, "day"),
|
||||
"day"
|
||||
)
|
||||
) {
|
||||
} else if (moment(time).isSame(moment().subtract(1, "day"), "day")) {
|
||||
yesterday.push(item);
|
||||
} else {
|
||||
box.push(item);
|
||||
}
|
||||
});
|
||||
}
|
||||
setTodayCourses(today);
|
||||
setYesterdayCourses(yesterday);
|
||||
setCourses(box);
|
||||
});
|
||||
}
|
||||
setLoading(false);
|
||||
});
|
||||
};
|
||||
|
@ -13,7 +13,7 @@ export function clearToken() {
|
||||
}
|
||||
|
||||
export function dateFormat(dateStr: string) {
|
||||
return moment(dateStr).format("YYYY-MM-DD HH:mm");
|
||||
return moment(dateStr).utcOffset(0).format("YYYY-MM-DD HH:mm");
|
||||
}
|
||||
|
||||
export function getHost() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user