fix(datetime): set working parts to last selected value #29610
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.
Issue number: resolves #29604, #29094
What is the current behavior?
When assigning multiple selected dates that span different months, the date time will not set the correct working parts and instead fallback to the default date: May 28, 2021.
What is the new behavior?
When opening the datetime with multiple dates selected, the calendar will animate to the last value in the array of selected dates.
If the datetime is collapsed, body is not visible, is not a grid view or the user has made a selection of a new date, the calendar will not animate and instead will set the working parts to the current value selected (latest/last value).
Does this introduce a breaking change?
Other information
Internally we discussed setting the month view to the first value in the array. Upon further investigation I determined this is not the expected behavior. When a user interacts with multiple date selection, the most recent selection (their active view) is the last value in the array. Animating or updating the working parts to the first value in the array would result in the calendar month jumping after every selection. Using the last index of the array results in no odd jumps in the experience. If a developer wishes to configure this behavior, they can change the order of the values in the value assigned to the datetime (to cause a specific month/date to be the initial view).