Skip to content

Commit f0dca00

Browse files
authored
Merge pull request #2053 from Ateina/2025-Calendar-not-displaying-Items
Fix timezone issue in Calendar month view. Closes #2025
2 parents 4c5f684 + 2ad1a4e commit f0dca00

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/controls/calendar/Calendar.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
webLightTheme,
88
} from '@fluentui/react-components';
99
import { ICalendarStyles, useCalendarStyles } from './hooks/useCalendarStyles';
10-
import { addDays, startOfMonth, startOfWeek } from 'date-fns';
10+
import { addDays, startOfMonth, startOfWeek, format } from 'date-fns';
1111
import { useEffect, useRef, useState } from 'react';
1212

1313
import { Day } from './Day';
@@ -213,8 +213,9 @@ export const Calendar: React.FC<ICalendarControlProps> = ({
213213
currentDate.getFullYear(),
214214
currentDate.getMonth()
215215
);
216-
const dayString = date.toISOString().split('T')[0];
217-
return monthEvents[dayString]?.flatMap((slot) => slot) || [];
216+
const dayString = format(date, 'yyyy-MM-dd');
217+
const dayEvents = monthEvents[dayString]?.flatMap((slot) => slot) || [];
218+
return dayEvents;
218219
},
219220
[currentDate, events]
220221
);

0 commit comments

Comments
 (0)