Skip to content

Commit edbe633

Browse files
committed
feat: use date fns for date calculations
1 parent 6184240 commit edbe633

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/views/Home/components/ActionButtons/ActionButtons.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import {FC, useCallback} from "react";
2-
import data from "../../../../data/2024.json";
2+
import data from "../../../../data/2025.json";
33
import Button from "../../../../components/UI/Button";
44
import styled from "styled-components";
5+
import {isWithinInterval} from "date-fns";
56
import {BIG_BREAKPOINT} from "../../../../constants/BreakPoints";
67
import {gaEventTracker} from "../../../../components/analytics/Analytics";
78

@@ -24,8 +25,9 @@ const ActionButtons: FC<React.PropsWithChildren<unknown>> = () => {
2425
const sponsorshipEndDay = new Date(data.sponsors.endDate);
2526
const today = new Date();
2627

28+
2729
const isBetween = (startDay: Date, endDay: Date): boolean =>
28-
startDay < new Date() && endDay > today;
30+
isWithinInterval(today, {start: startDay, end:endDay});
2931

3032
const trackSponsorshipInfo = useCallback(() => {
3133
gaEventTracker("sponsorship", "sponsorship");
@@ -39,6 +41,7 @@ const ActionButtons: FC<React.PropsWithChildren<unknown>> = () => {
3941
gaEventTracker("CFP", "CFP");
4042
}, []);
4143

44+
4245
return (
4346
<StyledActionDiv>
4447
<Button

0 commit comments

Comments
 (0)