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(date-textbox): ensure correct date range order #2166

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

LuLaValva
Copy link
Member

@LuLaValva LuLaValva commented May 3, 2024

Description

  • Ensure that date range is always in the correct order, even when entered manually

@LuLaValva LuLaValva self-assigned this May 3, 2024
Copy link

changeset-bot bot commented May 3, 2024

🦋 Changeset detected

Latest commit: b75e9bd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@ebay/ebayui-core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@LuLaValva LuLaValva changed the title fix(date-textbox): ensure order and add disabled state fix(date-textbox): ensure correct date range order May 3, 2024
Copy link
Contributor

@agliga agliga left a comment

Choose a reason for hiding this comment

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

I think there's a bad bug with this.
If there's a date selected in both inputs and I type in a date after the second one then they swap. I think that creates a bad UX.
My feeling in that case is that the second date should probably clear rather than swap.

This case that we are trying to fix should only be applied when I use the calendar popover thingy.

"@ebay/ebayui-core": patch
---

Order preservation fix
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we name this to be date-textbox: order preservation fix

const valueDate = new Date(value);
const iso = isNaN(valueDate.getTime()) ? null : dateArgToISO(valueDate);
if (index === 0) {
this.state.firstSelected = iso;
if (this.state.secondSelected && iso > this.state.secondSelected) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think there can be a cleaner way to do this.
Lets first fix the issue with the date being swapped when typing manually. And then I will revisit this.

@agliga
Copy link
Contributor

agliga commented May 8, 2024

Blocking issue for now until we get more feedback on how to approach this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants