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

feat(datetime): add multiple date selection #25514

Merged
merged 40 commits into from
Jul 20, 2022
Merged

Conversation

amandaejohnston
Copy link
Contributor

@amandaejohnston amandaejohnston commented Jun 21, 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)
    • Some docs updates need to be made in the ionic-docs repo, in a separate PR. See the contributing guide for details.
  • 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?

Only one date can be selected at a time.

Issue URL: Resolves #24674

What is the new behavior?

New multiple prop added, allowing for multiple date selection when presentation="date". See internal design doc for full description of functionality.

Does this introduce a breaking change?

  • Yes
  • No

Other information

Dev build: 6.1.14-dev.11657720710.1df41c89
PR for playground: ionic-team/ionic-docs#2442

@github-actions github-actions bot added package: angular @ionic/angular package package: vue @ionic/vue package labels Jun 30, 2022
Copy link
Contributor

@sean-perkins sean-perkins left a comment

Choose a reason for hiding this comment

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

General questions around the experience:

After deselecting a date that was previous selected, the day remains active, if you hover away to a different day:
Screen Shot 2022-07-15 at 12 27 20 PM

I compared against Mobiscroll and there's remains active until you hover off the date cell. It does feel strange that it remains active until clicking off.

Now that we can select multiple days in the same month, the active ring has the ability to collide with a selected cell (visually). Should we adjust the design at all?
Screen Shot 2022-07-15 at 12 30 49 PM

The functional behavior looks great though 🎉

* If `true`, multiple dates can be selected at once. Only
* applies to `presentation="date"` and `preferWheel="false"`.
*/
@Prop() multiple = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

~ Noticed that 1/2 of our implementations have a default value and the other set the value to false. Unsure if any action is needed here, but we should probably land on consistency in the next major.

For example:

  • AccordionGroup, Input - multiple is unset
  • Select - multiple defaults to false

This does affect the type signatures that are generated, but I am unsure of the impact of the field being marked as optional vs. required from the devs perspective.

@amandaejohnston
Copy link
Contributor Author

Hmm... the faded circle around focused days shows you where you are when using keyboard navigation, so changing how that behaves may get confusing 🤔 Mobiscroll shows an entirely different circle (a gray outline) when using the keyboard. I'm okay with everything how it is, since it balances form and function in my eyes, but I could be persuaded otherwise.

/**
* The value of the datetime as a valid ISO 8601 datetime string.
* Will be an array of strings if `multiple="true"`.
Copy link
Contributor

Choose a reason for hiding this comment

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

This is confusing since this is the prop that users manually set. Does this mean that datetime will automatically convert 2022-06-01 to ['2022-06-01'] when multiple="true"? Or is this meant to indicate that the value in the ionChange payload will be an array?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm... more the ionChange piece, though it also applies to the value you can access via e.g. datetimeEl.value. I think saying "should" instead of "will" gets closer to what I meant.

core/src/components/datetime/utils/state.ts Show resolved Hide resolved
core/src/components/datetime/utils/parse.ts Show resolved Hide resolved
core/src/components/datetime/utils/parse.ts Show resolved Hide resolved
core/src/components/datetime/test/multiple/datetime.e2e.ts Outdated Show resolved Hide resolved
core/src/components/datetime/test/multiple/datetime.e2e.ts Outdated Show resolved Hide resolved
core/src/components/datetime/datetime.tsx Show resolved Hide resolved
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 -- this is good to go once the below comments are addressed.

core/src/components/datetime/utils/state.ts Show resolved Hide resolved
core/src/components/datetime/utils/comparison.ts Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: angular @ionic/angular package package: core @ionic/core package package: vue @ionic/vue package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants