Skip to content

Commit 38d6b43

Browse files
Merge pull request #16 from StreetSupport/staging
Merge staging into main
2 parents 9095dbe + f2056b7 commit 38d6b43

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/utils/swep.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,12 @@ export function formatSwepActivePeriod(swepData: ISwepBanner): string {
3131
const fromString = activeFrom.toLocaleDateString('en-GB', formatOptions);
3232
const untilString = activeUntil.toLocaleDateString('en-GB', formatOptions);
3333

34-
if (now < activeFrom) {
35-
return `SWEP will be active from ${fromString} until ${untilString}`;
36-
} else if (now > activeUntil) {
37-
return `SWEP was active from ${fromString} until ${untilString}`;
38-
} else {
39-
return `SWEP is currently active from ${fromString} until ${untilString}`;
40-
}
34+
return `SWEP is currently active from ${fromString} until ${untilString}`;
35+
} else if (swepData.SwepActiveFrom && !swepData.SwepActiveUntil) {
36+
const activeFrom = new Date(swepData.SwepActiveFrom);
37+
const fromString = activeFrom.toLocaleDateString('en-GB', formatOptions);
38+
39+
return `SWEP is currently active from ${fromString}`;
4140
} else {
4241
return 'Active period not specified';
4342
}

0 commit comments

Comments
 (0)