use dayjs utc mode to improve before/after performance (#10544)

pull/10545/head
Alex van Andel 2023-08-02 18:03:04 +01:00 committed by GitHub
parent bf050b498c
commit 23f97bdd3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -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;