JsDaddy / ngx-mask

Angular Plugin to make masks on form fields and html elements.
https://jsdaddy.github.io/ngx-mask
MIT License
1.16k stars 300 forks source link

Combination of decimalMarker and leadZero results in empty input with mismatching language settings #1213

Closed ischerf-buhl closed 1 year ago

ischerf-buhl commented 1 year ago

🐞 bug report

Is this a regression?

No. As leadZero is involved and that is quite new as I understand it.

Description

When using this specific combination of settings and value, the displayed value is simply empty.

πŸ”¬ Minimal Reproduction

Use mask='separator.n', make use decimalMarker with the German ',' and use leadZero. Have your browser run in English.

<input type="text" mask="separator.2" [ngModel]="val" decimalMarker="," [leadZero]="true" /> https://stackblitz.com/edit/angular-hckbzh?file=src%2Fmain.ts

🌍 Your Environment

Angular Version: Local environment: 16.1 Stackblitz example: 16.2

System: Windows 10

Browser: Firefox (116) The language of the browser seems to be the important part though.

Anything else relevant?

If the value entered does not have any decimals, the value is displayed.

Also, if you enter a value manually to field it seems to work - just the initial setup is broken.

andriikamaldinov1 commented 1 year ago

@ischerf-buhl Thanks for using Ngx-Mask. Please update to latest version. All work as expected - https://stackblitz.com/edit/angular-nyfyq6?file=src%2Fmain.ts