diff --git a/client/src/components/TertiaryButton.tsx b/client/src/components/TertiaryButton.tsx index 813217f9..fec17fed 100644 --- a/client/src/components/TertiaryButton.tsx +++ b/client/src/components/TertiaryButton.tsx @@ -3,9 +3,6 @@ import styled from "styled-components"; import { IconProp } from "@fortawesome/fontawesome-svg-core"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -/** - * Specify - */ interface Props { children?: ReactNode; onClick?: MouseEventHandler; diff --git a/client/src/utils/timeFormatter.ts b/client/src/utils/timeFormatter.ts index a6a7b162..9bee6908 100644 --- a/client/src/utils/timeFormatter.ts +++ b/client/src/utils/timeFormatter.ts @@ -58,3 +58,9 @@ export const formatProgramItemDuration = (mins: number): string => { return `${hoursStr} ${minutesStr}`; }; + +export const formattedCurrentTime = (currentTime: Date): string => { + const timeFormat = "HH:mm:ss"; + // eslint-disable-next-line no-restricted-syntax -- We want to call format here + return dayjs(currentTime).tz(TIMEZONE).format(timeFormat); +}; diff --git a/client/src/views/admission-ticket/Admission.tsx b/client/src/views/admission-ticket/Admission.tsx index fa668ac9..8baefc15 100644 --- a/client/src/views/admission-ticket/Admission.tsx +++ b/client/src/views/admission-ticket/Admission.tsx @@ -3,12 +3,14 @@ import styled from "styled-components"; import { useTranslation } from "react-i18next"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { capitalize } from "lodash-es"; -import dayjs from "dayjs"; -import { getTime, getWeekdayAndTime } from "client/utils/timeFormatter"; +import { + formattedCurrentTime, + getTime, + getWeekdayAndTime, +} from "client/utils/timeFormatter"; import { config } from "shared/config"; import { ProgramItem } from "shared/types/models/programItem"; import { RaisedCard } from "client/components/RaisedCard"; -import { TIMEZONE } from "shared/utils/initializeDayjs"; interface Props { programItem: ProgramItem; @@ -37,19 +39,13 @@ export const Admission = ({ }, 1000); }, []); - const formattedCurrentTime = (): string => { - const timeFormat = "HH:mm:ss"; - // eslint-disable-next-line no-restricted-syntax -- We want to call format here - return dayjs(currentTime).tz(TIMEZONE).format(timeFormat); - }; - return ( {eventName} {eventYear} - {formattedCurrentTime()} + {formattedCurrentTime(currentTime)} {programItem.title} {formatTime()}