Skip to content

Commit bd7842a

Browse files
committed
refactor: Update holiday dates in the doc-sites to use the current year dynamically
- Changed the initialization of selectedDate to use the current date. - Updated holiday dates to reflect the current year instead of hardcoded values.
1 parent ae89e36 commit bd7842a

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

docs-site/src/examples/ts/holidayDates.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,18 @@ type Holiday = {
44
};
55

66
const HolidayDates = () => {
7-
const [selectedDate, setSelectedDate] = useState<Date | null>(new Date());
7+
const today = new Date();
8+
const [selectedDate, setSelectedDate] = useState<Date | null>(today);
89

910
const holidays: Holiday[] = [
10-
{ date: "2023-08-15", holidayName: "India's Independence Day" },
11-
{ date: "2023-12-31", holidayName: "New Year's Eve" },
12-
{ date: "2023-12-25", holidayName: "Christmas" },
13-
{ date: "2024-01-01", holidayName: "New Year's Day" },
14-
{ date: "2023-11-23", holidayName: "Thanksgiving Day" },
11+
{
12+
date: `${today.getFullYear()}-03-15`,
13+
holidayName: "India's Independence Day",
14+
},
15+
{ date: `${today.getFullYear()}-12-31`, holidayName: "New Year's Eve" },
16+
{ date: `${today.getFullYear()}-12-25`, holidayName: "Christmas" },
17+
{ date: `${today.getFullYear()}-01-01`, holidayName: "New Year's Day" },
18+
{ date: `${today.getFullYear()}-11-23`, holidayName: "Thanksgiving Day" },
1519
];
1620

1721
return (

0 commit comments

Comments
 (0)