Repository navigation
fix(datetime): clamp date between min and max when using month picker - #27185
Merged
Merged
Conversation
|
|
averyrousseau
marked this pull request as ready for review
April 12, 2023 19:41
averyrousseau
requested review from
a team,
liamdebeasi and
sean-perkins
as code owners
April 12, 2023 19:41
liamdebeasi
reviewed
Apr 13, 2023
liamdebeasi
left a comment
Contributor
There was a problem hiding this comment.
Would it make sense to clamp the date in setActiveParts instead? That would ensure that all dates set are guaranteed to be valid.
Contributor
|
+1 to what Liam mentioned, I wonder if we can add this logic as part of the |
Contributor
Author
|
Looks like that works! |
liamdebeasi
approved these changes
Apr 17, 2023
sean-perkins
approved these changes
Apr 18, 2023
3 tasks done
liamdebeasi
pushed a commit
that referenced
this pull request
Apr 19, 2023
…#27185) <!-- Please refer to our contributing documentation for any questions on submitting a pull request, or let us know here if you need any help: https://ionicframework.com/docs/building/contributing --> <!-- Some docs updates need to be made in the `ionic-docs` repo, in a separate PR. See https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#modifying-documentation for details. --> <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> When using the dropdown month picker, the value is updated when the month is changed, to follow native behavior. However, because only the month is updated (the day remains the same), it's possible for the newly chosen date to fall outside the min/max bounds of the datetime. For example, if you have a datetime with `min="2021-01-15" value="2021-02-01"`, then use the month picker to switch to January, the new value will be `2021-01-01` which is earlier than the `min`. <!-- Issues are required for both bug fixes and features. --> Issue URL: Resolves #27027 ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> When updating the `activeParts` in any scenario, the date to set is now clamped between the max and min. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. -->
Contributor
Author
|
@madalinporojan2010 Please create a new issue with details: https://github.com/ionic-team/ionic-framework/issues/new/choose |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the current behavior?
When using the dropdown month picker, the value is updated when the month is changed, to follow native behavior. However, because only the month is updated (the day remains the same), it's possible for the newly chosen date to fall outside the min/max bounds of the datetime.
For example, if you have a datetime with
min="2021-01-15" value="2021-02-01", then use the month picker to switch to January, the new value will be2021-01-01which is earlier than themin.Issue URL: Resolves #27027
What is the new behavior?
When updating the
activePartsin any scenario, the date to set is now clamped between the max and min.Does this introduce a breaking change?
Other information