auto-webmcp 0.3.19 → 0.3.20

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.
@@ -1794,6 +1794,18 @@ function serializeFormData(form, params, fieldEls) {
1794
1794
  }
1795
1795
  return result;
1796
1796
  }
1797
+ function maybeConvertIsoDate(value, el) {
1798
+ const isoMatch = value.match(/^(\d{4})-(\d{2})-(\d{2})$/);
1799
+ if (!isoMatch)
1800
+ return value;
1801
+ if (el instanceof HTMLInputElement && el.type === "date")
1802
+ return value;
1803
+ const fieldHint = (el.name ?? el.id ?? "").toLowerCase();
1804
+ if (!/date/.test(fieldHint))
1805
+ return value;
1806
+ const [, year, month, day] = isoMatch;
1807
+ return `${month}/${day}/${year}`;
1808
+ }
1797
1809
  function fillElement(el, value) {
1798
1810
  if (el instanceof HTMLInputElement) {
1799
1811
  const type = el.type.toLowerCase();
@@ -1808,7 +1820,7 @@ function fillElement(el, value) {
1808
1820
  el.dispatchEvent(new Event("change", { bubbles: true }));
1809
1821
  }
1810
1822
  } else {
1811
- setReactValue(el, String(value ?? ""));
1823
+ setReactValue(el, maybeConvertIsoDate(String(value ?? ""), el));
1812
1824
  }
1813
1825
  } else if (el instanceof HTMLTextAreaElement) {
1814
1826
  setReactValue(el, String(value ?? ""));
@@ -1867,7 +1879,7 @@ async function fillComboboxButton(el, value) {
1867
1879
  console.log("[auto-webmcp] fillComboboxButton: clicking button, value=", JSON.stringify(text));
1868
1880
  el.dispatchEvent(new MouseEvent("click", { bubbles: true, cancelable: true }));
1869
1881
  const listbox = await new Promise((resolve) => {
1870
- const deadline = Date.now() + 1e3;
1882
+ const deadline = Date.now() + 3e3;
1871
1883
  const poll = () => {
1872
1884
  const candidate = document.querySelector('[role="listbox"]') ?? document.querySelector('[role="option"]')?.closest('[role="listbox"]') ?? null;
1873
1885
  if (candidate) {