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

Error on selecting date with the maximum option available in singleDatePicker mode #525

Open
anuragyg opened this issue May 30, 2023 · 0 comments

Comments

@anuragyg
Copy link

anuragyg commented May 30, 2023

@fetrarij
Versions

  • Angular version: 13
  • component version: 5.0.2

Describe the bug
On selection of the min and max values possible from the dropdown i.e. the year 2028 or 1973, it throws an error where it says Cannot read properties of undefined (reading 'month'). This makes the app to freeze and any click anywhere results in console error count to increase.
Have tried to upgrade to latest version available of the package but same issue is still there.

To Reproduce
Steps to reproduce the behavior:

  1. Open the date picker.
  2. Select the year as 2028 i.e. the highest value available in the dropdown.
  3. Error can be seen in console which breaks the reactive form.
  4. Same goes for min date as well.

Expected behavior
A clear and concise description of what you expected to happen.

The date/year should get selected without any error as this behavior is only seen when we select the least and highest possible value of the year available.

Screenshots
image
image

Stackblitz link
https://fetrarij.github.io/ngx-daterangepicker-material/reactive-forms

Additional context
Faced this error in our application and tried to replicate it in the demo link and same issue seen there as well.
Could you please help?

Code snippet below for reference: <input ngxDaterangepickerMd matInput class="fx-date-range" type="text" [locale]="{format: 'DD/MM/YYYY',displayFormat: 'DD/MM/YYYY'}" [opens]="'left'" [closeOnAutoApply]="true" [autoApply]="true" [singleDatePicker]="true" [linkedCalendars]="true" [showDropdowns]="true" [minDate]="minDate" formControlName="dateValue" (endDateChanged)="onEndDateChanged($event)">

Could you also please tell us how is the max year option in the dropdown 2028? Where is this being set? Also, how to resolve the error so that we can resolve this issue in our app as well. Appreciate the help. Thanks in advance.

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

1 participant