@dev-blinq/bvt-playwright-js 1.0.0-dev.4.latest.66.1 → 1.0.0-dev.4.latest.78.1

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/index.mjs CHANGED
@@ -27734,7 +27734,25 @@ var DateEvaluator = class {
27734
27734
  const upperBound = rest ? parseDate(`in ${rest}`, now, { forwardDate: true }) ?? new Date(now.getTime() + 720 * 60 * 60 * 1e3) : new Date(now.getTime() + 720 * 60 * 60 * 1e3);
27735
27735
  return new Date(now.getTime() + Math.random() * (upperBound.getTime() - now.getTime()));
27736
27736
  }
27737
- return parseDate(expr, now, { forwardDate: true });
27737
+ const monthDay = this.parseMonthWithDay(expr, now);
27738
+ if (monthDay) return monthDay;
27739
+ return parseDate(this.normalizeExpression(expr), now, { forwardDate: true });
27740
+ }
27741
+ normalizeExpression(expr) {
27742
+ return expr.replace(/\b(next|last|previous|this)\s+week\s+(mon|tues?|wed(?:nes)?|thurs?|fri|sat(?:ur)?|sun)(day)?\b/gi, (_match, qualifier, weekdayStem, daySuffix) => `${weekdayStem}${daySuffix ?? ""} ${qualifier} week`);
27743
+ }
27744
+ parseMonthWithDay(expr, now) {
27745
+ const trimmed = expr.trim();
27746
+ const qualifierFirst = trimmed.match(/^(next|last|previous|this)\s+month\s+(\d{1,2})(?:st|nd|rd|th)?$/i);
27747
+ const dayFirst = trimmed.match(/^(\d{1,2})(?:st|nd|rd|th)?\s+(?:of\s+)?(next|last|previous|this)\s+month$/i);
27748
+ const match = qualifierFirst ?? dayFirst;
27749
+ if (!match) return null;
27750
+ const qualifier = (qualifierFirst ? match[1] : match[2]).toLowerCase();
27751
+ const day = parseInt(qualifierFirst ? match[2] : match[1], 10);
27752
+ const monthOffset = qualifier === "next" ? 1 : qualifier === "last" || qualifier === "previous" ? -1 : 0;
27753
+ const target = new Date(now.getFullYear(), now.getMonth() + monthOffset, day, now.getHours(), now.getMinutes(), now.getSeconds(), now.getMilliseconds());
27754
+ if (target.getDate() !== day) return null;
27755
+ return target;
27738
27756
  }
27739
27757
  formatDate(date, format) {
27740
27758
  if (format === "iso") return date.toISOString();