Skip to content

Commit e814fc0

Browse files
committed
Kickoff time formatted for current edition
1 parent 6e845a0 commit e814fc0

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

dotcom-rendering/src/components/FootballPreMatchDetails.stories.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,7 @@ export const Default = {
1818
awayTeam: 'Arsenal',
1919
league: 'Premier League',
2020
venue: 'Old Trafford',
21+
kickOff: new Date('2026-02-15T17:00:00Z'),
22+
edition: 'UK',
2123
},
2224
} satisfies Story;

dotcom-rendering/src/components/FootballPreMatchDetails.tsx

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ import {
1313
LinkButton,
1414
SvgArrowRightStraight,
1515
} from '@guardian/source/react-components';
16+
import {
17+
type EditionId,
18+
getLocaleFromEdition,
19+
getTimeZoneFromEdition,
20+
} from '../lib/edition';
1621
import { palette } from '../palette';
1722

1823
const containerCss = css`
@@ -56,14 +61,32 @@ type PreMatchProps = {
5661
awayTeam: string;
5762
league: string;
5863
venue: string;
64+
kickOff: Date;
65+
edition: EditionId;
5966
};
6067

6168
export const FootballPreMatchDetails = ({
6269
homeTeam,
6370
awayTeam,
6471
league,
6572
venue,
73+
kickOff,
74+
edition,
6675
}: PreMatchProps) => {
76+
const kickOffTime = new Intl.DateTimeFormat(getLocaleFromEdition(edition), {
77+
hour: 'numeric',
78+
minute: 'numeric',
79+
hour12: true,
80+
weekday: 'long',
81+
day: 'numeric',
82+
month: 'short',
83+
year: 'numeric',
84+
timeZoneName: 'short',
85+
timeZone: getTimeZoneFromEdition(edition),
86+
}).format(kickOff);
87+
88+
console.log(new Date());
89+
6790
return (
6891
<div css={containerCss}>
6992
<h3 css={headingCss}>
@@ -72,7 +95,7 @@ export const FootballPreMatchDetails = ({
7295
<div css={detailsCss}>
7396
<span>{league}</span>
7497
<span>{venue}</span>
75-
<time css={kickOffCss}>Today, 8:30pm</time>
98+
<time css={kickOffCss}>{kickOffTime}</time>
7699
</div>
77100
<LinkButton
78101
href="/football/fixtures"

0 commit comments

Comments
 (0)