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

Mask "0000-M0" is not handled correctly for month.

Open johanrg opened this issue 1 year ago • 3 comments

🐞 bug report

The month can not be entered for a date sometimes when formatted as "0000-M0".

Description

As an example, trying to enter the date 1975-01 will only enter 1975-0, the 1 will not be entered.

There is a pattern here that is repeatable for all centuries where the year is greater than or equal to 32, and less than the next decade. As an example 1932 to 1939, 1942 to 1949 and all the way up to 1992-1999. Same with 1732, 1832, 2032 etc.

For each of those dates, only the first number of the month can be inserted.

🔬 Minimal Reproduction

https://angular-c8dqxg.stackblitz.io

🌍 Your Environment

Angular Version:




@angular-devkit/architect       0.1601.0
@angular-devkit/build-angular   16.1.0
@angular-devkit/core            16.1.0
@angular-devkit/schematics      16.1.0
@angular/cli                    16.1.0
@schematics/angular             16.1.0
rxjs                            7.5.6
typescript                      5.1.6

Anything else relevant?

Using MacOS, tested with Chrome, Firefox and Safari.

johanrg avatar Jan 05 '24 10:01 johanrg

@johanrg Thanks for using Ngx-mask. Please update to latest version. It example all work as expected - https://stackblitz.com/edit/stackblitz-starters-lnx1re?file=src%2Fmain.ts

andriikamaldinov1 avatar Mar 28 '24 16:03 andriikamaldinov1

Great! Thank you for fixing this bug.

I found a semi-related bug when testing, If you set the attribute [showMaskTyped]="true", it ignores the M0 limitation and allows you to set any value you want.

johanrg avatar Mar 28 '24 17:03 johanrg

@johanrg Could you provide stackblitz with problem? If you u use [showMaskTyped]="true" with this mask u can add [leadZeroDateTime]="true", it will be add zero if month incorrect It example - https://stackblitz.com/edit/stackblitz-starters-4b4jpj?file=src%2Fmain.ts

andriikamaldinov1 avatar Mar 29 '24 13:03 andriikamaldinov1

This issue has been locked due to inactivity. Please file a new issue by teamplate if you are encountering a similar or related problem.

andriikamaldinov1 avatar Jul 03 '24 10:07 andriikamaldinov1