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

Removing and adding back first 5 on 05-05-2025 witg date mask M0-d0-yyyy while [leadZeroDateTime]="true" breaks the value.

Open TomaszStanik opened this issue 5 months ago • 0 comments

🐞 bug report

Is this a regression?

No.

Description

Using [leadZeroDateTime]="true" looks to breaking the value if the mask is m0-d0-yyyy and the value is 05-05-2025. Also [keepCharacterPositions]="true" didn't seems to work in this case.

When we will remove first 5 char from the month and add it back, then the value will be converted to 05-00-5202.

It looks like it is not removing 0 properly.

🔬 Minimal Reproduction

Use this code

   <input 
          type="text"
          formControlName="date"
          mask="M0-d0-0000"
          [keepCharacterPositions]="true"
          [leadZeroDateTime]="true"
          placeholder="mm-dd-yyyy">

https://stackblitz.com/edit/sb1-ejiz9w7o?file=src%2Fmain.ts

🔥 Exception or Error

No exception.

🌍 Your Environment

Angular Version: 19.2.8

Ngx Mask Version: 19.0.7*

TomaszStanik avatar May 26 '25 07:05 TomaszStanik