Skip to content

Commit

Permalink
Fix review comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
Maija Nevala committed Sep 2, 2024
1 parent cc3cd42 commit 3c6fb03
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
3 changes: 0 additions & 3 deletions client/src/components/TertiaryButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions client/src/utils/timeFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
16 changes: 6 additions & 10 deletions client/src/views/admission-ticket/Admission.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 (
<RaisedCard>
<TextContainer>
<Text>
{eventName} {eventYear}
</Text>
<TimeText>{formattedCurrentTime()}</TimeText>
<TimeText>{formattedCurrentTime(currentTime)}</TimeText>

<BoldText>{programItem.title}</BoldText>
<Text>{formatTime()}</Text>
Expand Down

0 comments on commit 3c6fb03

Please sign in to comment.