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

Calendar - when using monthNavigator/yearNavigator and binding a date - current month/year is based on today vs. the bound date #6261

Closed
sgentile opened this issue Aug 7, 2018 · 9 comments
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@sgentile
Copy link

sgentile commented Aug 7, 2018

Latest version 6.1.0

I have a control, ie.

<p-calendar showButtonBar="true" [required]="true" [showIcon]="true" [showOnFocus]="false" formControlName="termStartDate" [monthNavigator]="true" [yearNavigator]="true" [yearRange]="getYearRange()"></p-calendar>

When I use [monthNavigator]="true" [yearNavigator]="true" and bound a date - let's say today is August 2018 but the formControlName value is December 2017.

When opening the calendar, the date is in the dropdown is 'August' '2018' instead of 'December 2017'

If I remove the [monthNavigator]="true" [yearNavigator]="true" then it functions correctly.

@oliverfrost
Copy link

I encountered this issue too.

Current behavior
Provided date is selected in Calendar but if that date belongs to previous months Calendar will be opened on current month and dates after 'maxDate' will be available for selection. Using navigation arrows fix the issue.
Calendar opens correctly if date belongs to current month.

Expected behavior
When calendar opens it should be synchronized with it`s value. If 'minDate'/'MaxDate' are present date before/after should be disabled correctly.

Minimal reproduction of the problem with instructions
Please see: https://stackblitz.com/edit/github-uggfuf
Please note I updated existing template to latest stable PrimeNG and Angular versions.

Please tell us about your environment:
Windows 10, x64

Angular version: 6.1
PrimeNG version: 6.1.0
Browser: All
Language: All
**Node: ** 8.11.2

@oliverfrost
Copy link

Duplicate of: 6209

@cagataycivici
Copy link
Member

Duplicate

@billysvensson
Copy link

If you close this one, then please open #6209. This issue is not resolved.

@cagataycivici cagataycivici reopened this Aug 14, 2018
@cagataycivici cagataycivici self-assigned this Aug 14, 2018
@cagataycivici cagataycivici added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Aug 14, 2018
@cagataycivici cagataycivici added this to the 6.1.1 milestone Aug 14, 2018
@cagataycivici
Copy link
Member

Replicated

@OleksandrLazorenko
Copy link

Does it work as intended? I've created https://stackblitz.com/edit/angular-ffnp7w with version 6.1.2.
When i open calendar i see that dropdowns synced correctly, however see next problems:

  1. when i change month - year jumps to current year
  2. when i change year - month jumps to current month
  3. navigation arrows use current date, not model that i've provided

@haripalpatil
Copy link

Does it work as intended? I've created https://stackblitz.com/edit/angular-ffnp7w with version 6.1.2.
When i open calendar i see that dropdowns synced correctly, however see next problems:

  1. when i change month - year jumps to current year
  2. when i change year - month jumps to current month
  3. navigation arrows use current date, not model that i've provided

Did you get fix or workaround for this issue? Please let me know

@alanjosephk
Copy link

Try adding [defaultDate]="date" to your html. Provided, date will be the value same as that of ngModel

@ryan1509
Copy link

ryan1509 commented Dec 8, 2019

@alanjosephk Thanks, this is working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

8 participants