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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unmaskedValue for DateMask returns .. if only mask is present #1025

Open
MysterieDev opened this issue Apr 10, 2024 · 2 comments
Open

unmaskedValue for DateMask returns .. if only mask is present #1025

MysterieDev opened this issue Apr 10, 2024 · 2 comments

Comments

@MysterieDev
Copy link

MysterieDev commented Apr 10, 2024

Describe the bug
I discovered that when i checked the unmasked value for length and was suprised the empty mask with only the pattern returns '..' . Is this intentional?

To Reproduce
Make date input and get unmaskedValue of Mask after init

Expected behavior
the unmasked value should probably be an empty string

Additional context

in my project i have a function unmasking the value like this:
/** replace all underscores followed by dots,then replaces all underscores
*
*/
private unmaskValue(value: string) {
return value.replaceAll(/.+/g, '').replaceAll('', '');
}

that first makes a __.__.____ string go to this state: _____ and these get replace clean by the second replaceAll.

Thank you for your work.

@MysterieDev
Copy link
Author

I'll add a working reproduction sample when I got the time!

@MysterieDev
Copy link
Author

MysterieDev commented Apr 12, 2024

here is a stackblitz link that is supposed to explain the situation better.
https://stackblitz.com/edit/vitejs-vite-r5jzc8?file=main.js&terminal=dev

When experimenting, i've notice that masked._value shows the actual value that i was expecting form unmaskedValue of the IMaskInstance. However it seems that if it is a bit flimsy when typing the last character of the date.

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

No branches or pull requests

1 participant