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

keepCharacterPositions Not Functioning Correctly with Date Mask

Open isrraelgutierrez opened this issue 4 months ago • 0 comments

🐞 bug report

Is this a regression?

No

Description

The keepCharacterPositions property does not maintain character positions as expected when using a date mask. When a character is deleted from the middle of the input, subsequent characters shift positions, ignoring the keepCharacterPositions setting.

🔬 Minimal Reproduction

Steps to Reproduce:

Implement an input field with the following properties:

<input type="text" class="field__control" mask="M0/d0/0000" [keepCharacterPositions]="true" />

Focus on the input field and enter a date, such as "12/14/2020".

Delete a middle character, for example, the "4" in "12/14/2020".

Observe how all characters after the deleted "4" shift positions, disregarding the keepCharacterPositions setting.

🌍 Your Environment

Package Version

@angular-devkit/architect 0.1802.19 @angular-devkit/build-angular 18.2.19 @angular-devkit/core 17.3.16 @angular-devkit/schematics 17.3.16 @angular/cdk 18.2.14 @angular/cli 18.2.19 @schematics/angular 17.3.16 ng-packagr 18.2.1 rxjs 6.6.3 typescript 5.4.5 zone.js 0.14.10

"ngx-mask": "^19.0.7"

isrraelgutierrez avatar Jun 13 '25 16:06 isrraelgutierrez