@internationalized/date 3.5.1-nightly.4345 → 3.5.1-nightly.4349

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/import.mjs CHANGED
@@ -439,7 +439,7 @@ function $14e0f24ef4ac5c92$var$getRegion(locale) {
439
439
  if (!region) {
440
440
  // @ts-ignore
441
441
  region = new Intl.Locale(locale).maximize().region;
442
- $14e0f24ef4ac5c92$var$cachedRegions.set(locale, region);
442
+ if (region) $14e0f24ef4ac5c92$var$cachedRegions.set(locale, region);
443
443
  }
444
444
  return region;
445
445
  }
@@ -448,13 +448,13 @@ function $14e0f24ef4ac5c92$var$getRegion(locale) {
448
448
  // then this is a unicode extension, so ignore it.
449
449
  // Otherwise, it should be the region.
450
450
  let part = locale.split("-")[1];
451
- return part === "u" ? null : part;
451
+ return part === "u" ? undefined : part;
452
452
  }
453
453
  function $14e0f24ef4ac5c92$var$getWeekStart(locale) {
454
454
  // TODO: use Intl.Locale for this once browsers support the weekInfo property
455
455
  // https://github.com/tc39/proposal-intl-locale-info
456
456
  let region = $14e0f24ef4ac5c92$var$getRegion(locale);
457
- return (0, $2fe286d2fb449abb$export$7a5acbd77d414bd9)[region] || 0;
457
+ return region ? (0, $2fe286d2fb449abb$export$7a5acbd77d414bd9)[region] || 0 : 0;
458
458
  }
459
459
  function $14e0f24ef4ac5c92$export$ccc1b2479e7dd654(date, locale) {
460
460
  let days = date.calendar.getDaysInMonth(date);
@@ -1225,8 +1225,8 @@ function $fae977aafc393c5c$export$ecae829bb3747ea6(value) {
1225
1225
  minutes: parseDurationGroup((_match_groups7 = match.groups) === null || _match_groups7 === void 0 ? void 0 : _match_groups7.minutes, isNegative, 0, 59),
1226
1226
  seconds: parseDurationGroup((_match_groups8 = match.groups) === null || _match_groups8 === void 0 ? void 0 : _match_groups8.seconds, isNegative, 0, 59)
1227
1227
  };
1228
- if (duration.hours % 1 !== 0 && (duration.minutes || duration.seconds)) throw new Error(`Invalid ISO 8601 Duration string: ${value} - only the smallest unit can be fractional`);
1229
- if (duration.minutes % 1 !== 0 && duration.seconds) throw new Error(`Invalid ISO 8601 Duration string: ${value} - only the smallest unit can be fractional`);
1228
+ if (duration.hours !== undefined && duration.hours % 1 !== 0 && (duration.minutes || duration.seconds)) throw new Error(`Invalid ISO 8601 Duration string: ${value} - only the smallest unit can be fractional`);
1229
+ if (duration.minutes !== undefined && duration.minutes % 1 !== 0 && duration.seconds) throw new Error(`Invalid ISO 8601 Duration string: ${value} - only the smallest unit can be fractional`);
1230
1230
  return duration;
1231
1231
  }
1232
1232
 
package/dist/main.js CHANGED
@@ -504,7 +504,7 @@ function $1f0f7ebf1ae6c530$var$getRegion(locale) {
504
504
  if (!region) {
505
505
  // @ts-ignore
506
506
  region = new Intl.Locale(locale).maximize().region;
507
- $1f0f7ebf1ae6c530$var$cachedRegions.set(locale, region);
507
+ if (region) $1f0f7ebf1ae6c530$var$cachedRegions.set(locale, region);
508
508
  }
509
509
  return region;
510
510
  }
@@ -513,13 +513,13 @@ function $1f0f7ebf1ae6c530$var$getRegion(locale) {
513
513
  // then this is a unicode extension, so ignore it.
514
514
  // Otherwise, it should be the region.
515
515
  let part = locale.split("-")[1];
516
- return part === "u" ? null : part;
516
+ return part === "u" ? undefined : part;
517
517
  }
518
518
  function $1f0f7ebf1ae6c530$var$getWeekStart(locale) {
519
519
  // TODO: use Intl.Locale for this once browsers support the weekInfo property
520
520
  // https://github.com/tc39/proposal-intl-locale-info
521
521
  let region = $1f0f7ebf1ae6c530$var$getRegion(locale);
522
- return (0, $4d88eff242b38a9e$export$7a5acbd77d414bd9)[region] || 0;
522
+ return region ? (0, $4d88eff242b38a9e$export$7a5acbd77d414bd9)[region] || 0 : 0;
523
523
  }
524
524
  function $1f0f7ebf1ae6c530$export$ccc1b2479e7dd654(date, locale) {
525
525
  let days = date.calendar.getDaysInMonth(date);
@@ -1290,8 +1290,8 @@ function $4c32e2d98e5a5134$export$ecae829bb3747ea6(value) {
1290
1290
  minutes: parseDurationGroup((_match_groups7 = match.groups) === null || _match_groups7 === void 0 ? void 0 : _match_groups7.minutes, isNegative, 0, 59),
1291
1291
  seconds: parseDurationGroup((_match_groups8 = match.groups) === null || _match_groups8 === void 0 ? void 0 : _match_groups8.seconds, isNegative, 0, 59)
1292
1292
  };
1293
- if (duration.hours % 1 !== 0 && (duration.minutes || duration.seconds)) throw new Error(`Invalid ISO 8601 Duration string: ${value} - only the smallest unit can be fractional`);
1294
- if (duration.minutes % 1 !== 0 && duration.seconds) throw new Error(`Invalid ISO 8601 Duration string: ${value} - only the smallest unit can be fractional`);
1293
+ if (duration.hours !== undefined && duration.hours % 1 !== 0 && (duration.minutes || duration.seconds)) throw new Error(`Invalid ISO 8601 Duration string: ${value} - only the smallest unit can be fractional`);
1294
+ if (duration.minutes !== undefined && duration.minutes % 1 !== 0 && duration.seconds) throw new Error(`Invalid ISO 8601 Duration string: ${value} - only the smallest unit can be fractional`);
1295
1295
  return duration;
1296
1296
  }
1297
1297