@wix/form-public 0.219.0 → 0.220.0

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/index.cjs CHANGED
@@ -26663,12 +26663,13 @@ function formatCurrency(_temp) {
26663
26663
  } = _temp === void 0 ? {} : _temp;
26664
26664
  const amountNumber = Number(amount);
26665
26665
  if (currency) {
26666
+ const fractionDigits = decimalCount ?? getDisplayPrecision(amountNumber);
26666
26667
  return Intl.NumberFormat(locale, {
26667
26668
  style: "currency",
26668
26669
  unitDisplay: "narrow",
26669
26670
  currency,
26670
- minimumFractionDigits: decimalCount,
26671
- maximumFractionDigits: decimalCount ?? getPrecision(amountNumber)
26671
+ minimumFractionDigits: fractionDigits,
26672
+ maximumFractionDigits: fractionDigits
26672
26673
  }).format(amountNumber);
26673
26674
  }
26674
26675
  if (decimalCount) {
@@ -26676,9 +26677,8 @@ function formatCurrency(_temp) {
26676
26677
  }
26677
26678
  return String(amount);
26678
26679
  }
26679
- function getPrecision(amount) {
26680
- var _amount$toString$spli;
26681
- return ((_amount$toString$spli = amount.toString().split(".")[1]) == null ? void 0 : _amount$toString$spli.length) || 0;
26680
+ function getDisplayPrecision(amount) {
26681
+ return Number.isInteger(amount) ? 0 : 2;
26682
26682
  }
26683
26683
 
26684
26684
  // ../../node_modules/libphonenumber-js/metadata.min.json.js