File tree Expand file tree Collapse file tree 9 files changed +19
-5
lines changed Expand file tree Collapse file tree 9 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ type Story = StoryObj<typeof meta>;
34
34
35
35
export const Default = {
36
36
args : {
37
+ now : '2025-03-24T15:53:12.604Z' ,
37
38
edition : 'UK' ,
38
39
guardianBaseUrl : 'https://www.theguardian.com' ,
39
40
initialDays,
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ type Props = {
32
32
edition : EditionId ;
33
33
guardianBaseUrl : string ;
34
34
getMoreDays ?: ( ) => Promise < Result < 'failed' , FootballMatches > > ;
35
+ now : string ;
35
36
} ;
36
37
37
38
const REMOVE_TRAILING_DOTS_REGEX = / \. + $ / ;
@@ -221,10 +222,12 @@ const MatchWrapper = ({
221
222
children,
222
223
} : {
223
224
match : FootballMatch ;
224
- now : Date ;
225
+ now : string ;
225
226
children : ReactNode ;
226
227
} ) => {
227
- if ( shouldRenderMatchLink ( new Date ( match . dateTimeISOString ) , now ) ) {
228
+ if (
229
+ shouldRenderMatchLink ( new Date ( match . dateTimeISOString ) , new Date ( now ) )
230
+ ) {
228
231
return (
229
232
< li css = { matchListItemStyles } >
230
233
< a
@@ -260,7 +263,7 @@ const Match = ({
260
263
} : {
261
264
match : FootballMatch ;
262
265
timeFormatter : Intl . DateTimeFormat ;
263
- now : Date ;
266
+ now : string ;
264
267
} ) => (
265
268
< MatchWrapper match = { match } now = { now } >
266
269
< MatchStatus match = { match } timeFormatter = { timeFormatter } />
@@ -387,14 +390,13 @@ export const FootballMatchList = ({
387
390
guardianBaseUrl,
388
391
initialDays,
389
392
getMoreDays,
393
+ now,
390
394
} : Props ) => {
391
395
const dateFormatter = getDateFormatter ( edition ) ;
392
396
const timeFormatter = getTimeFormatter ( edition ) ;
393
397
394
398
const [ days , setDays ] = useState ( initialDays ) ;
395
399
const [ isError , setIsError ] = useState < boolean > ( false ) ;
396
- const now = new Date ( ) ;
397
-
398
400
return (
399
401
< >
400
402
{ days . map ( ( day ) => (
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ type Story = StoryObj<typeof meta>;
13
13
14
14
export const Results = {
15
15
args : {
16
+ now : '2025-03-24T15:53:12.604Z' ,
16
17
regions,
17
18
guardianBaseUrl : 'https://www.theguardian.com' ,
18
19
kind : 'Result' ,
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ type Props = {
28
28
getMoreDays ?: ( ) => Promise < Result < 'failed' , FootballMatches > > ;
29
29
renderAds : boolean ;
30
30
pageId : string ;
31
+ now : string ;
31
32
} ;
32
33
33
34
const createTitle = ( kind : FootballMatchKind , edition : EditionId ) => {
@@ -47,6 +48,7 @@ const createTitle = (kind: FootballMatchKind, edition: EditionId) => {
47
48
48
49
export const FootballMatchesPage = ( {
49
50
regions,
51
+ now,
50
52
guardianBaseUrl,
51
53
kind,
52
54
initialDays,
@@ -121,6 +123,7 @@ export const FootballMatchesPage = ({
121
123
` }
122
124
>
123
125
< FootballMatchList
126
+ now = { now }
124
127
initialDays = { initialDays }
125
128
edition = { edition }
126
129
getMoreDays = { getMoreDays }
Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ const goToCompetitionSpecificPage =
63
63
64
64
type Props = {
65
65
regions : Region [ ] ;
66
+ now : string ;
66
67
guardianBaseUrl : string ;
67
68
ajaxUrl : string ;
68
69
kind : FootballMatchKind ;
@@ -75,6 +76,7 @@ type Props = {
75
76
76
77
export const FootballMatchesPageWrapper = ( {
77
78
regions,
79
+ now,
78
80
guardianBaseUrl,
79
81
ajaxUrl,
80
82
kind,
@@ -92,6 +94,7 @@ export const FootballMatchesPageWrapper = ({
92
94
guardianBaseUrl = { guardianBaseUrl }
93
95
kind = { kind }
94
96
initialDays = { initialDays }
97
+ now = { now }
95
98
edition = { edition }
96
99
goToCompetitionSpecificPage = { goToCompetitionSpecificPage (
97
100
guardianBaseUrl ,
Original file line number Diff line number Diff line change @@ -379,6 +379,7 @@ export type Region = {
379
379
380
380
export type DCRFootballDataPage = {
381
381
matchesList : FootballMatches ;
382
+ now : string ;
382
383
kind : FootballMatchKind ;
383
384
nextPage ?: string ;
384
385
previousPage ?: string ;
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ type Story = StoryObj<typeof meta>;
15
15
export const Results = {
16
16
args : {
17
17
footballData : {
18
+ now : '2025-03-24T15:53:12.604Z' ,
18
19
matchesList : initialDays ,
19
20
regions,
20
21
kind : 'Result' ,
Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ export const FootballDataPageLayout = ({ footballData }: Props) => {
63
63
< Island priority = "feature" defer = { { until : 'visible' } } >
64
64
< FootballMatchesPageWrapper
65
65
regions = { footballData . regions }
66
+ now = { footballData . now }
66
67
guardianBaseUrl = { footballData . guardianBaseURL }
67
68
ajaxUrl = { footballData . config . ajaxUrl }
68
69
kind = { footballData . kind }
Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ const parseFEFootballData = (data: FEFootballDataPage): DCRFootballDataPage => {
73
73
74
74
return {
75
75
matchesList : parsedMatchesList . value ,
76
+ now : new Date ( ) . toISOString ( ) ,
76
77
kind : decidePageKind ( data . config . pageId ) ,
77
78
nextPage : data . nextPage ,
78
79
previousPage : data . previousPage ,
You can’t perform that action at this time.
0 commit comments