Skip to content

Commit

Permalink
Merge pull request #18 from BetterACS/fix-date-bug
Browse files Browse the repository at this point in the history
bug is already fix
  • Loading branch information
monshinawatra authored Jun 8, 2024
2 parents 91c1a40 + 7305066 commit 33a7141
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/components/module/event/eventCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export default function EventCard(props: any) {
description,
onChildClick,
avatar = 'https://avatars.githubusercontent.com/u/66357924?v=4',
due_date,
coin,
} = props;
const [modalOpen, setModalOpen] = useState(false);
const cardRef = useRef<any>();
Expand All @@ -32,6 +34,8 @@ export default function EventCard(props: any) {
description={description}
ref={cardRef}
setModalOpen={setModalOpen}
coin={coin}
due_date={due_date}
/>
)}
<Card
Expand Down
2 changes: 2 additions & 0 deletions src/components/module/event/eventModule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ export default function EventModule(props: BodyComponentProps) {
description={event.description}
onChildClick={clickPost}
avatar={`https://cdn.discordapp.com/avatars/${event.user.discord_id}/${event.user.avatar}.png`}
coin={event.coin_reward}
due_date={Math.max(Math.ceil((new Date(event.due_date).getTime()-Date.now()) / (1000 * 60 * 60 * 24)),0)}
/>
);
})}
Expand Down
2 changes: 1 addition & 1 deletion src/components/module/event/githubCarousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function GitHubCarousel(props: any) {
const dueDateTimestamp = new Date(due_date).getTime();
const currentTimestamp = Date.now();
const differenceInMilliseconds = dueDateTimestamp - currentTimestamp;
setDueDate(Math.max(Math.floor(differenceInMilliseconds / (1000 * 60 * 60 * 24)),0));
setDueDate(Math.max(Math.ceil(differenceInMilliseconds / (1000 * 60 * 60 * 24)),0));

};

Expand Down

0 comments on commit 33a7141

Please sign in to comment.