-
Notifications
You must be signed in to change notification settings - Fork 833
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
Mas warning on console The mask "__/__/____ __:__ _M" you passed is not valid for the format used P p. Falling down to uncontrolled not-masked input. #1776
Comments
I think the relevant code is here. I'll send a fix. |
@dmtrKovalenko There are 4 other occurrences of Filed #1803 for those. |
This error message comes from this check that essentially ensures that the provided mask is one of two allowed masks, both of which can be derived from the masks for the Given that the validation function knows exactly what it wants (it's not like it tests a regex or does sanity checks, it literally has the exact expected value there), I propose to just make the more sensible of these two allowed values the default value. (If users want to switch to the other one, then they can still do so by overriding the prop.) |
* Fix ternary condition for default mask values #1776 * add test case Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
@dmtrKovalenko What do you think of the solution proposed by @Philipp91 in #1776 (comment)? |
I'm getting the warning |
My date format <DateRangePicker
mask="__.__.____"
...
/> |
I'm trying to use DateRangePicker with a custom
I tried to add a |
@Philipp91 After further internal discussion, it came up that the reason this warning has to exist is because of the variable length of some of the parts of the date. Basically, in the US, In this context, a possible option is to give up on the localized format, for instance, https://github.com/dmtrKovalenko/date-io/blob/7bf469805c1fd73d072164c71d3a3267fcc42ce7/packages/date-fns/src/date-fns-utils.ts#L45 https://date-fns.org/v2.14.0/docs/format, and hard code the format to a full length version, meaning |
Any updates on this one @oliviertassinari? |
Still getting the warning even after 4.0.0-alpha.9 |
It was not released. Will be released today as alpha.10 |
The mask is not working for |
@BowlingX what you are describing sounds expected. It's the tradeoff highlighted in #1776 (comment). If you wish to explore the path of a smart mask, feel free to :). I wouldn't expect it to require too many lines of codes. |
Environment
Steps to reproduce
Code sandbox example: https://codesandbox.io/s/hungry-bohr-ugb2e?file=/src/App.js
Use basic example from the website.
Expected behavior
Not expecting any warnings from the example
Actual behavior
Mask warning on console "The mask "//____ : _M" you passed is not valid for the format used P p. Falling down to uncontrolled not-masked input. "
Live example
Code sandbox example: https://codesandbox.io/s/hungry-bohr-ugb2e?file=/src/App.js
The text was updated successfully, but these errors were encountered: