Skip to content

DateRangePicker: Quick Select Ranges looses highlighting when used with maxDate #6670

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

Closed
sher04lock opened this issue Jul 17, 2024 · 0 comments · Fixed by #6696
Closed

DateRangePicker: Quick Select Ranges looses highlighting when used with maxDate #6670

sher04lock opened this issue Jul 17, 2024 · 0 comments · Fixed by #6696

Comments

@sher04lock
Copy link

Bug description:

Using maxDate option causes bs-custom-date-view not highlighting selected quick range option, even if it's withing minDate-maxDate.

Working OK (highlighting selected option):

  <input
    type="text"
    bsDaterangepicker
    [bsConfig]="{
      ranges: ranges,
      adaptivePosition: true
    }"
  />

Not working (not highlighting):

  <input
    type="text"
    bsDaterangepicker
    [bsConfig]="{
      ranges: ranges,
      maxDate: maxDate,
      adaptivePosition: true
    }"
  />

I suspect the problem is in these lines:
[1]

[class.selected]="range.value === selectedRange">

[2]
const editedValues = date.map(item => {

We are comparing by reference in [1], which by default works ok. But with maxDate provided, we are creating new array in [2] - which breaks the comparision in the template.

Plunker/StackBlitz that reproduces the issue: https://stackblitz.com/edit/clkau7-grqzf4?file=src%2Fapp%2Fapp.component.html

Versions of ngx-bootstrap, Angular, and Bootstrap:

ngx-bootstrap: 12.0.0, 18.0.2
Angular: 17.1.3

Build system: Angular CLI, System.js, webpack, starter seed: Angular CLI

Expected behavior

Selected option to be highlighted, no matter if it was adjusted to match maxDate or not.

lexasq added a commit that referenced this issue Oct 25, 2024
) (#6698)

Co-authored-by: Dmytro Danylov <daniloff200@gmail.com>
lexasq added a commit that referenced this issue Oct 28, 2024
* fix(datepicker): fixed infinite cycle behavior

* fix(modal): fix for issue-6683 body is scrollable if you close just one modal

* fix(modal): fix for issue-6683 body is scrollable if you close just one modal

* fix(modal): issue-6675 animation and issue-6547

* fix(modal): nested modals backdrop added

* 18.1.3

* chore(versions): version bump

* fix(datepicker): quick ranges button is not selected with maxDate (#6670) (#6698)

Co-authored-by: Dmytro Danylov <daniloff200@gmail.com>

* fix(docs): fixed typo in import

---------

Co-authored-by: Dmytro Danylov <daniloff200@gmail.com>
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

Successfully merging a pull request may close this issue.

1 participant