Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
johanrg opened this issue Jan 5, 2024 · 3 comments
Open

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

johanrg opened this issue Jan 5, 2024 · 3 comments

Comments

@johanrg
Copy link

johanrg commented Jan 5, 2024

馃悶 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.

NepipenkoIgor pushed a commit that referenced this issue Mar 27, 2024
* feat(ref: #1298, #1302, #1301): fix issues

* fix(ref: #1292): fix percent mask with zero at start

* fix(ref: no-ref): remove unusable code

* fix(ref: no-ref): remove unusable code

* fix(ref: no-ref): remove unusable code

* fix(ref: no-ref): remove unusable code

* fix(ref: no-ref): replace + into template string
andriikamaldinov1 added a commit that referenced this issue Mar 27, 2024
andriikamaldinov1 added a commit that referenced this issue Mar 27, 2024
NepipenkoIgor pushed a commit that referenced this issue Mar 28, 2024
* fix(ref: #1298): fix issue

* fix(ref: #1306): add more information to custom pattern

* fix(ref: no-ref): remove unusable code

* fix(ref: no-ref): fix allowNegativeNumbers in demo
@andriikamaldinov1 andriikamaldinov1 mentioned this issue Mar 28, 2024
13 tasks
@andriikamaldinov1
Copy link
Collaborator

@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

@johanrg
Copy link
Author

johanrg commented Mar 28, 2024

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.

@NepipenkoIgor NepipenkoIgor reopened this Mar 29, 2024
@andriikamaldinov1
Copy link
Collaborator

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants