-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
bug: passing max only causes ion-datetime is out of bounds #25833
Comments
Thanks for the issue. I can confirm this is a bug. I have a dev build below with a proposed fix if you are interested in testing it:
|
@liamdebeasi Thanks for your quick response. Using that dev build I still receive the warning. Example 1:
Console log:
Example 2:
I pass only the year 2012 because according to the docs, this is valid: Console log:
Let me know if you want me to test any other case. |
I see you are using The intent of this message is to warn developers when they are passing a |
I did miss when
If |
I have tested the new dev build. My My goal is to have a field to ask: Select your date of birth control = new FormControl(null, Validators.required); And for the max setting:
Questions:
|
Do you have a GitHub repo I can use to test this behavior? It is hard to tell what is going on in your app since I cannot run it locally. |
Here is a demo repo with my scenario: |
Thanks! The issue is that I did not account for the empty string Using this dev build you should be able to avoid setting a default |
Got it. Now, using One thing to mention is that if I use just According to docs here: Passing just the year is not supposed to be valid? I would like to know the correct format to use on my scenario. |
Good catch. Yes, you should be able to pass in any valid ISO 8601 string. We mistakenly do not fill in missing date information when parsing This is a different bug, so I opened #25836. However, I have a dev build that has both fixes: |
Thanks for your response. I confirm with that dev build that now is working as intended, no matter the datetime format you use. Thanks a lot!. |
Thanks for the issue. This has been resolved via #25835, and a fix will be available in an upcoming release of Ionic Framework. |
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out. |
Prerequisites
Ionic Framework Version
Current Behavior
I have a field to select the date of birth. The rule is to start showing dates 10 years before today. In the meanwhile, the field should be empty until you select a date.
When setting the
max
to2012-08-26T12:47:01.977Z
or to2012
, I receive this warning:I understand the warning and I see that the Value (2022) is greater than the Max (2012). It seems that the component is picking up the today Date automatically.
Trying to set the field's value with the same
max
date that I have provided, the warning disappears.This can be confusing because the reality is that the user did not select a date yet. Also, when the user see that date, he can think that was automatically pulled from its account settings, which is false.
Expected Behavior
today
date automatically.Steps to Reproduce
Code Reproduction URL
No response
Ionic Info
Additional Information
Maybe this behavior was intended and decided for some reason, but if this is the case, how can I accomplish a simple UX like the one I have described before?
My goal is to let the user select a date in the past while keeping the field/component with no initial value.
The text was updated successfully, but these errors were encountered: