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

Month select box is empty when navigating to a prior year and displayMonths > 1 #2377

Closed
stevethemacguy opened this issue May 12, 2018 · 0 comments

Comments

@stevethemacguy
Copy link

stevethemacguy commented May 12, 2018

Bug description:

Month select box is empty (and the select options do not update) when navigating to the prior year with the left navigation arrow.

The bug occurs when maxDate is used and displayMonths > 1. Some maxDates work and others do not. At the time of writing (May 11, 2018), the following dates produce the bug:

this.maxDate = {year:2018, month:3, day:2}
this.maxDate = {year:2018, month:1, day:15}
this.maxDate = {year:2018, month:5, day:10}

But a date in April works fine with no bug:
this.maxDate = {year:2018, month:4, day:10}

Steps to reproduce:

  1. Use one of the broken dates above
  2. Click the left navigation arrow until you reach Dec, 2017
  3. Continue clicking the left navigation arrow.

Note: if you click the right navigation arrow before clicking the left arrow, the bug will not occur. To reproduce the bug, you have to click the left navigation arrow only.

Link to minimally-working plunker that reproduces the issue:

https://stackblitz.com/edit/datepicker-maxdate-bug

Version of Angular, ng-bootstrap, and Bootstrap:

Angular: 6.0.1
ng-bootstrap: 2.0.0
Bootstrap: N/A

@stevethemacguy stevethemacguy changed the title Month select box is empty when navigating to a prior year when displayMonths > 1 Month select box is empty when navigating to a prior year and displayMonths > 1 May 12, 2018
@pkozlowski-opensource pkozlowski-opensource added this to the 2.0.1 milestone May 14, 2018
@pkozlowski-opensource pkozlowski-opensource modified the milestones: 2.0.1, 2.1.0 May 25, 2018
@pkozlowski-opensource pkozlowski-opensource modified the milestones: 2.1.0, 2.1.1 Jun 1, 2018
divdavem added a commit to divdavem/ng-bootstrap that referenced this issue Jun 14, 2018
The list of months and years was generated from the focused date rather
than the first displayed date, which was inconsistent with the value used
in the datepicker navigation component, which uses the first displayed date.
This inconsistency was not visible when displayMonths = 1 but it sometimes
caused the following issue when several months were displayed:
the month select box was empty as it did not contain the currently displayed
month.

Closes ng-bootstrap#2377
maxokorokov pushed a commit that referenced this issue Jun 14, 2018
The list of months and years was generated from the focused date rather
than the first displayed date, which was inconsistent with the value used
in the datepicker navigation component, which uses the first displayed date.
This inconsistency was not visible when displayMonths = 1 but it sometimes
caused the following issue when several months were displayed:
the month select box was empty as it did not contain the currently displayed
month.

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

No branches or pull requests

2 participants