Skip to content
Devix Open Source

Every currency has its own number of decimals

The same amount in a dirham, a Kuwaiti dinar, a Pakistani rupee and a yen — and what each one is really worth in fils, paisa and none.

Live preview
<div class="demo demo--wide">
  <div class="demo-row">
    <div class="demo-seg" id="currency" role="group" aria-label="Currency">
      <button type="button" data-currency="AED" aria-pressed="true">AED</button>
      <button type="button" data-currency="KWD">KWD</button>
      <button type="button" data-currency="PKR">PKR</button>
      <button type="button" data-currency="JPY">JPY</button>
    </div>
    <div class="demo-seg" id="locale" role="group" aria-label="Language">
      <button type="button" data-locale="en-AE" aria-pressed="true">English</button>
      <button type="button" data-locale="ar-EG">العربية</button>
      <button type="button" data-locale="de-DE">Deutsch</button>
      <button type="button" data-locale="en-IN">हिन्दी</button>
    </div>
  </div>

  <form id="form" action="#" onsubmit="return false">
    <input class="demo-input" id="total" name="total" placeholder="0.00">
  </form>

  <dl class="demo-kv" id="out"></dl>

  <p class="demo-hint">Type <code>1234.56</code> into each. The dinar keeps three decimals; the yen
    refuses the point rather than making your amount a hundred times bigger. <strong>PKR is the one
    to look at</strong> — <code>Intl</code> says the rupee has no decimals, so a field built on it
    would silently drop the paisa.</p>
</div>