@outbuild-company/schedule-core 1.15.2 → 1.15.4

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.js CHANGED
@@ -5459,8 +5459,8 @@ function buildCalendarPatch(activity, newCalendarId, ctx) {
5459
5459
  };
5460
5460
  const newCalendar = ctx.calendars.getCalendar(newCalendarId);
5461
5461
  if (newCalendar) {
5462
- const calendarStart = newCalendar.getClosestWorkTime({
5463
- date: startOfUtcDay2(activity.startDate),
5462
+ const calendarStart = newCalendar.isWorkTime(activity.startDate, "hour") ? activity.startDate : newCalendar.getClosestWorkTime({
5463
+ date: activity.startDate,
5464
5464
  direction: "future",
5465
5465
  unit: "hour"
5466
5466
  });
@@ -5477,11 +5477,6 @@ function buildCalendarPatch(activity, newCalendarId, ctx) {
5477
5477
  }
5478
5478
  return fields;
5479
5479
  }
5480
- function startOfUtcDay2(date2) {
5481
- return new Date(
5482
- Date.UTC(date2.getUTCFullYear(), date2.getUTCMonth(), date2.getUTCDate())
5483
- );
5484
- }
5485
5480
 
5486
5481
  // src/generators/custom-id/constants.ts
5487
5482
  var DEFAULT_SUFFIX_INCREMENT = "10";
@@ -10277,13 +10272,13 @@ var legacy_default = CriticalPath;
10277
10272
 
10278
10273
  // src/critical-path/gantt-adapter.ts
10279
10274
  var isFinishConstraint = (type) => type === CONSTRAINT_TYPE.FNET || type === CONSTRAINT_TYPE.FNLT || type === CONSTRAINT_TYPE.MFO;
10280
- var startOfUtcDay3 = (date2) => new Date(
10275
+ var startOfUtcDay2 = (date2) => new Date(
10281
10276
  Date.UTC(date2.getUTCFullYear(), date2.getUTCMonth(), date2.getUTCDate())
10282
10277
  );
10283
10278
  function constraintDateForCriticalPath(activity, state) {
10284
10279
  const raw = activity.constraintDate;
10285
10280
  if (!raw || !isFinishConstraint(activity.constraintType)) return raw;
10286
- const midnight = startOfUtcDay3(raw);
10281
+ const midnight = startOfUtcDay2(raw);
10287
10282
  if (raw.getTime() !== midnight.getTime()) return raw;
10288
10283
  const firstWork = state.getClosestWorkTime({
10289
10284
  date: midnight,
@@ -12016,8 +12011,12 @@ function snapFreedMilestones(applied, beforeLinks, adapter) {
12016
12011
  if (!targetId || adapter.getIncomingLinkIds(targetId).length > 0) continue;
12017
12012
  const activity = adapter.getActivity(targetId);
12018
12013
  if (!activity || activity.type !== ACTIVITY_TYPE.MILESTONE) continue;
12014
+ const snapFrom = new Date(activity.startDate);
12015
+ if (adapter.getOutgoingLinkIds(targetId).length === 0) {
12016
+ snapFrom.setUTCHours(0, 0, 0, 0);
12017
+ }
12019
12018
  const startDate = adapter.getClosestWorkTime({
12020
- date: activity.startDate,
12019
+ date: snapFrom,
12021
12020
  dir: WORK_TIME_DIRECTION.FUTURE,
12022
12021
  task: activity
12023
12022
  });