uNmAnNeR / imaskjs

vanilla javascript input mask
https://imask.js.org
MIT License
4.96k stars 258 forks source link

How to disable the auto-deletion of trailing zeros in floating-point numbers? #1076

Open ipomazkin-fin opened 2 months ago

ipomazkin-fin commented 2 months ago

To Reproduce Having mask like this:

{
    mask: 'num',
    lazy: false,
    blocks: {
      num: {
        expose: true,
        mask: Number,
        radix: '.',
        thousandsSeparator: ',',
        scale: 4
      },
    },
  }

When user enter the value "1.2003" first and then tries to delete the last number (3) the lib automatically removes zeros. Expected: "1.2003" -> "1.200" Received: "1.2003" -> "1.2"

Environment:

Additional context Are there a way to disable this feature?