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

All the dates are selected in date range picker when setting startDate and endDate null or empty #360

Open
manishg345 opened this issue Mar 25, 2020 · 8 comments

Comments

@manishg345
Copy link

Subject of the issue

All the dates are selected in date range picker when setting startDate and endDate null or empty

[BUG] Bug Reproduce Steps

In DateRangePicker state object, set startDate and endDate as null

[BUG] Expected behaviour

Initially when both of the date textfields are set as blank, none of the date should be selected in the calendar of DRP

Environment

Package Version:
React version:
Node version:
Browser:

@shaohuahuang
Copy link

+1

1 similar comment
@ao-alex
Copy link

ao-alex commented Sep 4, 2020

+1

@fsdiogo
Copy link

fsdiogo commented Oct 26, 2020

+1, every day gets the rdrInRange class, which just doesn't make sense.

@gaieges
Copy link

gaieges commented Nov 4, 2020

Noted the same / similar issue in #330 (comment) with some demos there.

@bertho-zero
Copy link

To work around this I added a class rdrNoSelection:

  const rdrNoSelection = useMemo(
    () => {
      const range = ranges?.[0];
      return !range || (range.startDate === null && range.endDate === null);
    },
    [ranges]
  );
.rdrNoSelection {
  .rdrSelected, .rdrInRange, .rdrStartEdge, .rdrEndEdge {
    background: #fff;
  }

  .rdrDay:not(.rdrDayPassive) .rdrInRange ~ .rdrDayNumber span,
  .rdrDay:not(.rdrDayPassive) .rdrStartEdge ~ .rdrDayNumber span,
  .rdrDay:not(.rdrDayPassive) .rdrEndEdge ~ .rdrDayNumber span,
  .rdrDay:not(.rdrDayPassive) .rdrSelected ~ .rdrDayNumber span {
    color: $oa-black;

    &:after {
      background: $oa-blue;
    }
  }
}

@smitser
Copy link

smitser commented Dec 1, 2020

+1

@stephaned-ev
Copy link

It's an old issue but is there any update?

@KaziMuneeb
Copy link

KaziMuneeb commented Jul 24, 2024

To work around this I added a class rdrNoSelection:

  const rdrNoSelection = useMemo(
    () => {
      const range = ranges?.[0];
      return !range || (range.startDate === null && range.endDate === null);
    },
    [ranges]
  );
.rdrNoSelection {
  .rdrSelected, .rdrInRange, .rdrStartEdge, .rdrEndEdge {
    background: #fff;
  }

  .rdrDay:not(.rdrDayPassive) .rdrInRange ~ .rdrDayNumber span,
  .rdrDay:not(.rdrDayPassive) .rdrStartEdge ~ .rdrDayNumber span,
  .rdrDay:not(.rdrDayPassive) .rdrEndEdge ~ .rdrDayNumber span,
  .rdrDay:not(.rdrDayPassive) .rdrSelected ~ .rdrDayNumber span {
    color: $oa-black;

    &:after {
      background: $oa-blue;
    }
  }
}

where should i add the code?

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

No branches or pull requests

9 participants