diff --git a/app/calendar/components/CalendarPage.tsx b/app/calendar/components/CalendarPage.tsx index 9b37ced80..935e5629f 100644 --- a/app/calendar/components/CalendarPage.tsx +++ b/app/calendar/components/CalendarPage.tsx @@ -1,7 +1,7 @@ import { Button } from "@chakra-ui/button"; import { Input, InputGroup, InputLeftElement } from "@chakra-ui/input"; import { Box } from "@chakra-ui/layout"; -import { t, Trans } from "@lingui/macro"; +import { Trans } from "@lingui/macro"; import SubText from "components/common/SubText"; import { useMyTheme } from "hooks/common"; import { Fragment, useState } from "react"; @@ -63,10 +63,11 @@ export default function CalendarPage() { ]; } - const differenceInDays = Math.floor( - (lastPrintedDate![2].getTime() - new Date().getTime()) / - (1000 * 60 * 60 * 24) - ); + const now = new Date(); + + const isToday = + lastPrintedDate![2].getDate() === now.getDate() && + lastPrintedDate![2].getMonth() === now.getMonth(); return ( @@ -74,7 +75,7 @@ export default function CalendarPage() { {event.date.toLocaleDateString()}{" "} - {getTime(differenceInDays)} + {isToday && (Today)} )} @@ -106,10 +107,3 @@ export default function CalendarPage() { ); } - -function getTime(days: number) { - if (days < 1) return t`(Today)`; - if (days === 1) return t`(Tomorrow)`; - - return ""; -}