@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.
@@ -9742,7 +9742,32 @@ function readTypedDate(raw, opts = {}) {
9742
9742
  let month = null;
9743
9743
  let day = null;
9744
9744
  const numeric = /^(\d{1,4})[/.\-](\d{1,2})[/.\-](\d{1,4})$/.exec(dateText);
9745
- if (numeric) {
9745
+ const compact = /^(\d{8}|\d{6})$/.exec(dateText);
9746
+ if (compact) {
9747
+ const digits = compact[1];
9748
+ const order = localeDateOrder(opts.locale);
9749
+ const first2 = Number(digits.slice(0, 2));
9750
+ const mid2 = Number(digits.slice(2, 4));
9751
+ if (digits.length === 6) {
9752
+ year = twoDigitYear(Number(digits.slice(4)));
9753
+ if (order === "dmy") {
9754
+ day = first2;
9755
+ month = mid2;
9756
+ } else {
9757
+ month = first2;
9758
+ day = mid2;
9759
+ }
9760
+ } else {
9761
+ const yearLast = Number(digits.slice(4));
9762
+ const yearFirst = Number(digits.slice(0, 4));
9763
+ const localeReading = () => order === "dmy" ? [yearLast, mid2, first2] : [yearLast, first2, mid2];
9764
+ const [ly, lm, ld] = localeReading();
9765
+ const isoReading = [yearFirst, Number(digits.slice(4, 6)), Number(digits.slice(6))];
9766
+ const fits = (y, m, d) => checkDay(y, m, d, raw) === null;
9767
+ const useIso = order === "ymd" || !fits(ly, lm, ld) && fits(...isoReading);
9768
+ [year, month, day] = useIso ? isoReading : [ly, lm, ld];
9769
+ }
9770
+ } else if (numeric) {
9746
9771
  const [a, b, c] = [numeric[1], numeric[2], numeric[3]];
9747
9772
  if (a.length === 4) {
9748
9773
  year = Number(a);