Skip to content
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

fix(datetime): if no default value, don't highlight active day until one is selected #25151

Merged
merged 12 commits into from
Apr 26, 2022

Conversation

averyjohnston
Copy link
Contributor

@averyjohnston averyjohnston commented Apr 19, 2022

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Build (npm run build) was run locally and any changes were pushed
  • Lint (npm run lint) has passed locally and any fixes were made for failures

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

When an ion-datetime is initialized without a value defined, today's date is highlighted with a solid blue circle. This is misleading, as it looks like a day has already been selected.

Issue URL: #24456

What is the new behavior?

  • For datetimes with no initial value, no solid blue circle is rendered at first. Today's date is highlighted with an outline only. Once any day is clicked, the solid circle returns.
  • For datetimes with an initial value defined, behavior is unchanged.
  • The solid blue circle does not necessarily indicate which day the actual value property is set to at that moment. (I.e. it's possible to trigger the solid circle, but still have a nullish value.) This is to handle datetimes with confirm/cancel buttons, where the value does not change until confirm is called. (See: https://ionicframework.com/docs/api/datetime#confirming-selected-values)

Does this introduce a breaking change?

  • Yes
  • No

Other information

  • We decided not to enforce a non-nullish value in order to avoid unwanted ionChange events that would fire when the value is automatically switched to today.
  • An alternative would be to not default the activeParts to today if no initial value is set, but that would require allowing activeParts or all its properties to be null, which would require a small refactor. I figure the current method is simpler and safer.
  • Dev build: 6.1.2-dev.11650392645.12c652f6 (Posted in original issue)

@averyjohnston averyjohnston requested a review from a team as a code owner April 19, 2022 18:28
@github-actions github-actions bot added the package: core @ionic/core package label Apr 19, 2022
Copy link
Contributor

@liamdebeasi liamdebeasi left a comment

Choose a reason for hiding this comment

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

Great job!

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.

3 participants