Skip to content

Commit

Permalink
Fix #30: wrong time description for assignments
Browse files Browse the repository at this point in the history
  • Loading branch information
robertying committed Apr 11, 2019
1 parent 02bbc02 commit 6fd1304
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/components/AssignmentCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ const AssignmentCard: FunctionComponent<IAssignmentCardProps> = props => {
{attachment ? "附件 " + attachment : "无附件"}
</Text>
<Text style={{ color: "grey", fontSize: 12 }}>
{"还剩 " + dayjs().to(dayjs(date), true)}
{dayjs().isAfter(dayjs(date))
? dayjs().to(dayjs(date)) + "截止"
: "还剩 " + dayjs().to(dayjs(date), true)}
</Text>
</View>
</View>
Expand Down
7 changes: 1 addition & 6 deletions src/screens/CourseDetailScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down

0 comments on commit 6fd1304

Please sign in to comment.