ngx-mask icon indicating copy to clipboard operation
ngx-mask copied to clipboard

number input not parsed/displayed correctly with global decimalMarker/thousandSeparator config

Open lkoe opened this issue 4 years ago • 4 comments

If decimalMarker/thousandSeparator is configured globally, input decimal numbers are not parsed/displayed correctly

Using:

export const maskConfig: Partial<IConfig> = {
    thousandSeparator: ".",
    decimalMarker: ","
};

An input number 1234.56 (actual ts number value) becomes 123.456 in the input field, expected is 1.234,56.

It works correctly though, if thousandSeparator/decimalMarker is configured explicitly at the input field.

The issue can be viewed here: https://stackblitz.com/edit/ngx-mask-hwj1ep

lkoe avatar Nov 12 '20 15:11 lkoe

Me too!

lramondev avatar Nov 16 '20 20:11 lramondev

From what I saw the model has to be in accordance with the config ... =/ Ex: '1000,58' = 1.000,58

My backend sends a floating or decimal number. The library still doesn't understand that. ¬¬'' could work like the php number_format (decimal_value, ",", ".") would be great!

https://github.com/JsDaddy/ngx-mask/issues/680

lramondev avatar Nov 16 '20 20:11 lramondev

https://www.npmjs.com/package/ngx-currency

lramondev avatar Nov 17 '20 13:11 lramondev

Me too!

norivanoliveira avatar Mar 18 '21 22:03 norivanoliveira

@lkoe @norivanoliveira @lramondev Thanks for your using Ngx-Mask. Please update to latest version. It example, all work as expected - https://stackblitz.com/edit/angular-nr36ab?file=src%2Fmain.ts

andriikamaldinov1 avatar Jun 12 '23 14:06 andriikamaldinov1

@lkoe @norivanoliveira @lramondev Thanks for your using Ngx-Mask. Please update to latest version. It example, all work as expected - https://stackblitz.com/edit/angular-nr36ab?file=src%2Fmain.ts

Not Working. input an integer value example: 1000 expected: 1.000,00 result: 1.000

lramondev avatar Jun 12 '23 14:06 lramondev

@lramondev It example - https://stackblitz.com/edit/angular-2dzd4x?file=src%2Fmain.ts We add leadZero in version 16.1.3 All work as you needed

andriikamaldinov1 avatar Jun 12 '23 14:06 andriikamaldinov1

Nice. Thanksss!

lramondev avatar Jun 12 '23 14:06 lramondev