diff --git a/src/components/AssignmentCard.tsx b/src/components/AssignmentCard.tsx index 6c6952f7..3ae881ec 100644 --- a/src/components/AssignmentCard.tsx +++ b/src/components/AssignmentCard.tsx @@ -71,7 +71,9 @@ const AssignmentCard: FunctionComponent = props => { {attachment ? "附件 " + attachment : "无附件"} - {"还剩 " + dayjs().to(dayjs(date), true)} + {dayjs().isAfter(dayjs(date)) + ? dayjs().to(dayjs(date)) + "截止" + : "还剩 " + dayjs().to(dayjs(date), true)} diff --git a/src/screens/CourseDetailScreen.tsx b/src/screens/CourseDetailScreen.tsx index 3cbc8aab..9db7e2f7 100644 --- a/src/screens/CourseDetailScreen.tsx +++ b/src/screens/CourseDetailScreen.tsx @@ -89,12 +89,7 @@ const CourseDetailScreen: INavigationScreen< const notices = rawNotices.filter(item => item.courseId === courseId); const files = rawFiles.filter(item => item.courseId === courseId); - const assignments = [...rawAssignments] - .filter( - item => - item.courseId === courseId && dayjs(item.deadline).isAfter(dayjs()) - ) - .sort((a, b) => dayjs(a.deadline).unix() - dayjs(b.deadline).unix()); + const assignments = rawAssignments.filter(item => item.courseId === courseId); const [index, setIndex] = useState(0); const routes: any = [