Skip to content

Date range picker two calendar view display 4 buttons to change month instead of 2 #6581

Open
@FarlasDTP

Description

@FarlasDTP

Bug description:
In inline date range picker two calendar view all 4 button arrows to change month are visible when both min date and max date have same month.

StackBlitz: https://stackblitz.com/edit/angular-xfptm6?file=src/main.ts

Versions of ngx-bootstrap, Angular, and Bootstrap:
ngx-bootstrap: 10.3.0
Angular: 15.2.9
Bootstrap: 5.2.3

Expected behavior

Only 2 arrows to change month to be visible, it should look the same as when you comment out min date or max date in config.

Additional info

This function seems to be a problem, but I don't know why it check for it because for me one month display does not depend on min/max date.

function isDisplayOneMonth(viewDate: Date, minDate?: Date, maxDate?: Date) {
  if (maxDate && isSame(maxDate, viewDate, 'day')) {
    return true;
  }

  return minDate && maxDate && minDate.getMonth() === maxDate.getMonth();
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions