JsDaddy / ngx-mask

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

Bug: Backspace issue with floating numbers starting with 0 #1389

Closed HaRuT-1994 closed 1 month ago

HaRuT-1994 commented 1 month ago

There is a bug in ngx-mask when handling floating numbers that start with 0. Specifically, when trying to delete the third(ex, actually from middle) zero in a number like 0.00001 using the backspace key, the behavior is not as expected. The third zero should be deleted, resulting in the number 0.0001. However, when backspace is pressed, it changes to 0,001. If backspace is pressed again, it changes to 001.

NepipenkoIgor commented 1 month ago

@HaRuT-1994 Please provide https://stackblitz.com/

HaRuT-1994 commented 1 month ago

https://stackblitz.com/edit/stackblitz-starters-9vgrj9?file=src%2Fmain.ts

andriikamaldinov1 commented 1 month ago

@HaRuT-1994 Thanks for using Ngx-mask. Please update to latest version. It example all work as expected - https://stackblitz.com/edit/stackblitz-starters-ivdvo1?file=package.json