fix: extra 30-minute buffer was added to 60-minute slots without it being set (#24087)

* fix: 30 min buffer added on 60 min slots

* update

* fix test

* Update restrictionSchedule.test.ts

* addressed test

* Update getSchedule.test.ts
This commit is contained in:
Anik Dhabal Babu authored and GitHub committed 2025-10-09 18:37:52 +01:00
1 parent 5aa24c8472
commit 2a23911a5b
4 files changed
+75 -80

No files matched your search

+6 -1
View File
@@ -131,6 +131,11 @@ function buildSlotsWithDateRanges({
// For current day bookings, normalizing the seconds to zero to avoid issues with time calculations
slotStartTime = slotStartTime.set("second", 0).set("millisecond", 0);
// Convert to target timezone BEFORE checking if rounding is needed
// This ensures we check minute alignment in the local timezone, not UTC
// This prevents issues with half-hour offset timezones like Asia/Kolkata (GMT+5:30)
slotStartTime = slotStartTime.tz(timeZone);
if (slotStartTime.minute() % interval !== 0) {
slotStartTime = getCorrectedSlotStartTime({
@@ -141,7 +146,7 @@ function buildSlotsWithDateRanges({
});
}
slotStartTime = slotStartTime.add(offsetStart ?? 0, "minutes").tz(timeZone);
slotStartTime = slotStartTime.add(offsetStart ?? 0, "minutes");
// Find the nearest appropriate slot boundary if this time falls within an existing slot
const slotBoundariesValueArray = Array.from(slotBoundaries.keys());