@optionfactory/ful 7.0.3 → 7.0.5

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/ful.mjs CHANGED
@@ -1567,7 +1567,12 @@ class Input extends ParsedElement {
1567
1567
  this.replaceChildren(fragment);
1568
1568
  }
1569
1569
  get value() {
1570
- return this._input.value === '' ? null : this._input.value;
1570
+ const uppercase = this.hasAttribute('uppercase');
1571
+ const trim = this.hasAttribute('trim');
1572
+ const v = this._input.value;
1573
+ const uppercased = uppercase ? v.toUpperCase(): v;
1574
+ const trimmed = trim ? uppercased.trim(): uppercased;
1575
+ return trimmed === '' ? null : trimmed;
1571
1576
  }
1572
1577
  set value(value) {
1573
1578
  this._input.value = value === '' ? null : value;
@@ -1694,8 +1699,10 @@ class InputLocalDate extends Input {
1694
1699
  if (!v) {
1695
1700
  return '';
1696
1701
  }
1702
+ //this could be date.toLocaleDateString('en-CA')
1703
+ const formatLocalDate = (date) => new Date(date.getTime() - (date.getTimezoneOffset() * 60000)).toISOString().split("T")[0];
1697
1704
  if (v === 'now') {
1698
- return new Date().toISOString().split("T")[0];
1705
+ return formatLocalDate(new Date());
1699
1706
  }
1700
1707
  const re = /^([+-])(\d+)([dmy])$/;
1701
1708
  const match = re.exec(v);
@@ -1721,7 +1728,7 @@ class InputLocalDate extends Input {
1721
1728
  r.setFullYear(r.getFullYear() + offset * sign);
1722
1729
  break;
1723
1730
  }
1724
- return r.toISOString().split("T")[0];
1731
+ return formatLocalDate(r);
1725
1732
  }
1726
1733
  }
1727
1734