Skip to content

Commit a074a71

Browse files
committed
fix(calendar): correct date handling in getGregorianEvents function
1 parent 1c2f0bf commit a074a71

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/layouts/calendar/utils.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,12 @@ export function getHijriEvents(
6363

6464
export function getGregorianEvents(
6565
events: FetchedAllEvents,
66-
selectedDate: jalaliMoment.Moment, // Hijri date
66+
date: jalaliMoment.Moment,
6767
): FetchedEvent[] {
68-
const gregorianDay = selectedDate.format('D')
69-
const gregorianMonth = selectedDate.format('M')
68+
const gregorianDate = date.clone().locale('en').utc().add(3.5, 'hours')
69+
70+
const gregorianDay = gregorianDate.format('D')
71+
const gregorianMonth = gregorianDate.format('M')
7072
return events.gregorianEvents.filter(
7173
(event) => event.month === +gregorianMonth && event.day === +gregorianDay,
7274
)

0 commit comments

Comments
 (0)