From 9f01d485f59ea5e34bb469cf9e7d45c33602b1e2 Mon Sep 17 00:00:00 2001 From: CrisGrud Date: Thu, 29 Feb 2024 10:05:47 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20[Task]onEndTimeRange=20f?= =?UTF-8?q?unction=20refactored?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✅ Closes: #198 --- src/tasks/utils/tasks.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/tasks/utils/tasks.ts b/src/tasks/utils/tasks.ts index 1306d33..5c54921 100644 --- a/src/tasks/utils/tasks.ts +++ b/src/tasks/utils/tasks.ts @@ -174,10 +174,12 @@ export const onEndTimeRange = ( const nexDayMillis = startDate.startOf("day").toMillis() + 24 * hrs; let gap = 0; - if (diffTZ !== 0) { - gap = hrs * diffTZ; - if (diffTZInDay !== 0 && startTaskMillis < nexDayMillis) { - gap = 0; + if (resolution.unit === "day" || resolution.unit === "week") { + if (diffTZ !== 0) { + gap = hrs * diffTZ; + if (diffTZInDay !== 0 && startTaskMillis < nexDayMillis) { + gap = 0; + } } } const start = interval.start!.plus({ [resolution.unit]: timeOffset }).toMillis() - gap;