Skip to content

fix(datetime): do not animate to new value when multiple values in different months are set - #28847

Merged
averyrousseau merged 6 commits into
mainfrom
FW-5667-b
Jan 18, 2024
Merged

fix(datetime): do not animate to new value when multiple values in different months are set#28847
averyrousseau merged 6 commits into
mainfrom
FW-5667-b

Conversation

@averyrousseau

@averyrousseau averyrousseau commented Jan 17, 2024

Copy link
Copy Markdown
Contributor

Issue number: resolves #28602


What is the current behavior?

We animate to the new date when the value is changed, but we do not account for multiple selection. This behavior is valuable for when the value is set asynchronously on a different month than what it shown.

However, this is confusing when there are multiple dates selected in different months, because we do not reasonably know which date to animate to.

What is the new behavior?

Datetime no longer animates to the new value if more than one date is selected, and the selected dates aren't all in the same month.

An alternative strategy would be to always animate unless one of the selected dates is in the month currently being viewed. However, this would still mean guessing at which value the user wants to see, which we are trying to avoid.

Based on this PR: #28605

Does this introduce a breaking change?

  • Yes
  • No

Other information

Co-authored-by: Liam DeBeasi liamdebeasi@users.noreply.github.com

@github-actions github-actions Bot added the package: core @ionic/core package label Jan 17, 2024
const SINGLE_DATE = '2022-06-01';
const MULTIPLE_DATES = ['2022-06-01', '2022-06-02', '2022-06-03'];
const MULTIPLE_DATES_SEPARATE_MONTHS = ['2022-04-01', '2022-05-01', '2022-06-01'];
const MULTIPLE_DATES_SEPARATE_MONTHS = ['2022-03-01', '2022-04-01', '2022-05-01'];

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was changed to avoid any of these dates being in the same month as the MULTIPLE_DATES set above.

Comment thread core/src/components/datetime/test/multiple/datetime.e2e.ts
@averyrousseau
averyrousseau marked this pull request as ready for review January 17, 2024 20:22

@liamdebeasi liamdebeasi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix works well, just one question on the test.

Comment thread core/src/components/datetime/test/multiple/datetime.e2e.ts

@liamdebeasi liamdebeasi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test was missing an annotation, but otherwise looks good!

Comment thread core/src/components/datetime/test/multiple/datetime.e2e.ts
Comment thread core/src/components/datetime/test/multiple/datetime.e2e.ts
Co-authored-by: Liam DeBeasi <liamdebeasi@users.noreply.github.com>
@averyrousseau
averyrousseau added this pull request to the merge queue Jan 18, 2024
Merged via the queue into main with commit 9262f7d Jan 18, 2024
@averyrousseau
averyrousseau deleted the FW-5667-b branch January 18, 2024 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: core @ionic/core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Calendar month changes when selecting date on Multiple date mode

2 participants