-
Notifications
You must be signed in to change notification settings - Fork 305
Open
Description
🐞 bug report
Is this a regression?
No
Description
There is a different behavior when deleting the first figure of a number that is a multiple of 1000 and one that it's not in case all the remaining figures are 0.
Example
1,000,000 - delete first figure (1) -> 000,000
100,000 - delete first figure (1) -> 0
I would expect that the behavior is the same in both cases and the behavior should be the first one (multiple of 1000) - the zeros stay and you can quickly change from 100,000 to 200,000.
I think that the issue can be solved by patching the _toNumber method:
private _toNumber(value: string | number | undefined | null) {
if (!this.isNumberValue || value === MaskExpression.EMPTY_STRING) {
return value;
}
//TODO <- if value contains only zeros: return value;
if (
this.maskExpression.startsWith(MaskExpression.SEPARATOR) &&
(this.leadZero || !this.dropSpecialCharacters)
) {
return value;
}
// rest of the code
}
🔬 Minimal Reproduction
Can be reproduced easily on the demo page, section Separators: https://jsdaddy.github.io/ngx-mask/#1
🔥 Exception or Error
None
🌍 Your Environment
Angular Version: 17.3.12
Angular CLI: 17.3.8
Node: 20.19.3
Package Manager: npm 10.8.2
OS: darwin arm64
Angular: 17.3.12
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1703.8
@angular-devkit/build-angular 17.3.8
@angular-devkit/core 17.3.8
@angular-devkit/schematics 17.3.8
@angular/cdk 17.3.10
@angular/cli 17.3.8
@schematics/angular 17.3.8
ng-packagr 17.3.0
rxjs 7.8.1
typescript 5.4.5
zone.js 0.14.8
Anything else relevant?
No
Metadata
Metadata
Assignees
Labels
No labels