Fix: calendar timezone performance improvements (#2668)
This commit is contained in:
1 parent
93dc6db4ef
commit
72efd9a08d
7 files changed
+25
-28
No files matched your search
@@ -2,7 +2,7 @@ import { DateTime } from "luxon";
|
||||
import classNames from "classnames";
|
||||
import { useTranslation } from "next-i18next";
|
||||
|
||||
import Event, { compareDateTimezoneAware } from "./event";
|
||||
import Event, { compareDateTimezone } from "./event";
|
||||
|
||||
export default function Agenda({ service, colorVariants, events, showDate }) {
|
||||
const { widget } = service;
|
||||
@@ -15,10 +15,8 @@ export default function Agenda({ service, colorVariants, events, showDate }) {
|
||||
const eventsArray = Object.keys(events)
|
||||
.filter(
|
||||
(eventKey) =>
|
||||
showDate
|
||||
.setZone(events[eventKey].date.zoneName)
|
||||
.minus({ days: widget?.previousDays ?? 0 })
|
||||
.startOf("day").ts <= events[eventKey].date?.startOf("day").ts,
|
||||
showDate.minus({ days: widget?.previousDays ?? 0 }).startOf("day").ts <=
|
||||
events[eventKey].date?.startOf("day").ts,
|
||||
)
|
||||
.map((eventKey) => events[eventKey])
|
||||
.sort((a, b) => a.date - b.date)
|
||||
@@ -58,7 +56,7 @@ export default function Agenda({ service, colorVariants, events, showDate }) {
|
||||
event={event}
|
||||
colorVariants={colorVariants}
|
||||
showDate={j === 0}
|
||||
showTime={widget?.showTime && compareDateTimezoneAware(showDate, event)}
|
||||
showTime={widget?.showTime && compareDateTimezone(showDate, event)}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user