hierarchical-approval 4.1.3 → 4.2.0

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
@@ -5220,6 +5220,9 @@ function parseOrThrow(fn) {
5220
5220
  var DAY_MS = 864e5;
5221
5221
  var MAX_SCAN_DAYS = 3660;
5222
5222
  var MAX_BUSINESS_DAYS = 36600;
5223
+ function describeDate(d) {
5224
+ return Number.isNaN(d.getTime()) ? "Invalid Date" : d.toISOString();
5225
+ }
5223
5226
  function dayKey(d) {
5224
5227
  const y = d.getFullYear();
5225
5228
  const m = String(d.getMonth() + 1).padStart(2, "0");
@@ -5235,7 +5238,7 @@ function weekendCalendar(options = {}) {
5235
5238
  if (days <= 0 || Number.isNaN(days)) return new Date(from.getTime());
5236
5239
  if (days > MAX_BUSINESS_DAYS) {
5237
5240
  throw new ApprovalValidationError(
5238
- `weekendCalendar: cannot add ${days} business days to ${from.toISOString()} \u2014 days must be at most ${MAX_BUSINESS_DAYS}.`
5241
+ `weekendCalendar: cannot add ${days} business days to ${describeDate(from)} \u2014 days must be at most ${MAX_BUSINESS_DAYS}.`
5239
5242
  );
5240
5243
  }
5241
5244
  const whole = Math.floor(days);
@@ -5252,7 +5255,7 @@ function weekendCalendar(options = {}) {
5252
5255
  }
5253
5256
  if (++idleDays >= MAX_SCAN_DAYS) {
5254
5257
  throw new ApprovalValidationError(
5255
- `weekendCalendar: no business day found within 10 years of ${from.toISOString()} \u2014 check weekendDays and holidays.`
5258
+ `weekendCalendar: no business day found within 10 years of ${describeDate(from)} \u2014 check weekendDays and holidays.`
5256
5259
  );
5257
5260
  }
5258
5261
  }
@@ -5299,7 +5302,7 @@ function businessHoursCalendar(options = {}) {
5299
5302
  return cursor;
5300
5303
  }
5301
5304
  throw new ApprovalValidationError(
5302
- `businessHoursCalendar: no working day found within 10 years of ${from.toISOString()} \u2014 check weekendDays and holidays.`
5305
+ `businessHoursCalendar: no working day found within 10 years of ${describeDate(from)} \u2014 check weekendDays and holidays.`
5303
5306
  );
5304
5307
  };
5305
5308
  const base = weekendCalendar(options);