@ai-matrx/records 0.81.1 → 0.81.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.
@@ -9457,7 +9457,32 @@ function readTypedDate(raw, opts = {}) {
9457
9457
  let month = null;
9458
9458
  let day = null;
9459
9459
  const numeric = /^(\d{1,4})[/.\-](\d{1,2})[/.\-](\d{1,4})$/.exec(dateText);
9460
- if (numeric) {
9460
+ const compact = /^(\d{8}|\d{6})$/.exec(dateText);
9461
+ if (compact) {
9462
+ const digits = compact[1];
9463
+ const order = localeDateOrder(opts.locale);
9464
+ const first2 = Number(digits.slice(0, 2));
9465
+ const mid2 = Number(digits.slice(2, 4));
9466
+ if (digits.length === 6) {
9467
+ year = twoDigitYear(Number(digits.slice(4)));
9468
+ if (order === "dmy") {
9469
+ day = first2;
9470
+ month = mid2;
9471
+ } else {
9472
+ month = first2;
9473
+ day = mid2;
9474
+ }
9475
+ } else {
9476
+ const yearLast = Number(digits.slice(4));
9477
+ const yearFirst = Number(digits.slice(0, 4));
9478
+ const localeReading = () => order === "dmy" ? [yearLast, mid2, first2] : [yearLast, first2, mid2];
9479
+ const [ly, lm, ld] = localeReading();
9480
+ const isoReading = [yearFirst, Number(digits.slice(4, 6)), Number(digits.slice(6))];
9481
+ const fits = (y, m, d) => checkDay(y, m, d, raw) === null;
9482
+ const useIso = order === "ymd" || !fits(ly, lm, ld) && fits(...isoReading);
9483
+ [year, month, day] = useIso ? isoReading : [ly, lm, ld];
9484
+ }
9485
+ } else if (numeric) {
9461
9486
  const [a, b, c] = [numeric[1], numeric[2], numeric[3]];
9462
9487
  if (a.length === 4) {
9463
9488
  year = Number(a);