imask.js pads zeros at end different than the length of scale

595 Views Asked by At

In price mask (imask.js) I use this:

{
   mask: Number,
   signed: true,
   scale: 3,
   normalizeZeros: true,
   padFractionalZeros: true,
   ...
}

This adds max 3 extra zeroes at the end, because the scale is 3. I want to be abble to add max 2, while the scale is 3.

The scale should be 3, but the added extra zeros at the end should be max 2. How to achieve this?

Example:

4 -> 4.00       // extra 2 zeros added
4.5 -> 4.50     // 1 zero added
4.56 -> 4.56    // nothing added
4.50 -> 4.50    // nothing added or removed
4.567 -> 4.567  // nothing added or removed
0

There are 0 best solutions below