Add option to specify a timezone for events (#2623)
* Add option to specify a timezone for events * Amend message, update docs
This commit is contained in:
1 parent
674d7f2e01
commit
1f2081af5d
5 files changed
+23
-14
No files matched your search
@@ -2,7 +2,7 @@ import { DateTime } from "luxon";
|
||||
import classNames from "classnames";
|
||||
import { useTranslation } from "next-i18next";
|
||||
|
||||
import Event from "./event";
|
||||
import Event, { compareDateTimezoneAware } from "./event";
|
||||
|
||||
export default function Agenda({ service, colorVariants, events, showDate }) {
|
||||
const { widget } = service;
|
||||
@@ -15,8 +15,10 @@ export default function Agenda({ service, colorVariants, events, showDate }) {
|
||||
const eventsArray = Object.keys(events)
|
||||
.filter(
|
||||
(eventKey) =>
|
||||
showDate.minus({ days: widget?.previousDays ?? 0 }).startOf("day").ts <=
|
||||
events[eventKey].date?.startOf("day").ts,
|
||||
showDate
|
||||
.setZone(events[eventKey].date.zoneName)
|
||||
.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)
|
||||
@@ -56,7 +58,7 @@ export default function Agenda({ service, colorVariants, events, showDate }) {
|
||||
event={event}
|
||||
colorVariants={colorVariants}
|
||||
showDate={j === 0}
|
||||
showTime={widget?.showTime && event.date.startOf("day").ts === showDate.startOf("day").ts}
|
||||
showTime={widget?.showTime && compareDateTimezoneAware(showDate, event)}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user