@outbuild-company/schedule-core 1.15.0 → 1.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -5461,24 +5461,20 @@ function buildCalendarPatch(activity, newCalendarId, ctx) {
5461
5461
  };
5462
5462
  const newCalendar = ctx.calendars.getCalendar(newCalendarId);
5463
5463
  if (newCalendar) {
5464
- const isMilestone = activity.durationHours === 0;
5465
- const snapToShiftStart = isMilestone || activity.assignedDefaultCalendar;
5466
- const snapFrom = snapToShiftStart ? startOfUtcDay2(activity.startDate) : activity.startDate;
5467
5464
  const calendarStart = newCalendar.getClosestWorkTime({
5468
- date: snapFrom,
5465
+ date: startOfUtcDay2(activity.startDate),
5469
5466
  direction: "future",
5470
5467
  unit: "hour"
5471
5468
  });
5472
- if (!activity.autoScheduling || snapToShiftStart || newCalendar.getWorkHours(activity.startDate).length === 0) {
5473
- fields.startDate = calendarStart;
5474
- }
5469
+ fields.startDate = calendarStart;
5475
5470
  if (!activity.autoScheduling) {
5476
5471
  return fields;
5477
5472
  }
5478
- const endStart = fields.startDate ?? activity.startDate;
5479
5473
  Object.assign(
5480
5474
  fields,
5481
- setEndDate(newCalendar.calculateEndDate(endStart, activity.durationHours))
5475
+ setEndDate(
5476
+ newCalendar.calculateEndDate(calendarStart, activity.durationHours)
5477
+ )
5482
5478
  );
5483
5479
  }
5484
5480
  return fields;