From 23f97bdd3c7006a35a62a83d1584cd52fab19180 Mon Sep 17 00:00:00 2001 From: Alex van Andel Date: Wed, 2 Aug 2023 18:03:04 +0100 Subject: [PATCH] use dayjs utc mode to improve before/after performance (#10544) --- packages/lib/date-ranges.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/lib/date-ranges.ts b/packages/lib/date-ranges.ts index 878ba8963e..ee26ebdb39 100644 --- a/packages/lib/date-ranges.ts +++ b/packages/lib/date-ranges.ts @@ -157,9 +157,9 @@ export function intersect(ranges: DateRange[][]): DateRange[] { } function getIntersection(range1: DateRange, range2: DateRange) { - const start = range1.start.isAfter(range2.start) ? range1.start : range2.start; - const end = range1.end.isBefore(range2.end) ? range1.end : range2.end; - if (start.isBefore(end)) { + const start = range1.start.utc().isAfter(range2.start) ? range1.start : range2.start; + const end = range1.end.utc().isBefore(range2.end) ? range1.end : range2.end; + if (start.utc().isBefore(end)) { return { start, end }; } return null;