-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Keep currentYear and currentMonth in sync with the control value #6217
Comments
Any updates on this? It would be great to have this fixed. The calendar jumps when you try to use it after setting through the form. |
@csabasimon can you share your work-around code to set those values on focus? From event.target how do i set those values? Thanks! |
+1 any update on this? we need this resolved ASAP |
.ts file
.html
|
@csabasimon you rock! This was really helpful. That fixed our issue. In case anyone is using date range...
|
We're also having this problem with the calendar widget. |
Please demonstrate your case at stackblitz by using the issue template below. Issues without a test case have much less possibility to be reviewd in detail and assisted. https://stackblitz.com/github/primefaces/primeng-issue-template |
I'm submitting a ... (check one with "x")
Current behavior
When setting the calendar's value through the formControl (either calling setValue or typing in the input field), the calendar's currentMonth and currentYear don't get updated. This leads to an unexpected behavior when using previous/next month buttons. Since those buttons rely on the currentMonth/year, the calendar will jump to the previous/next month prior to today's date.
eg.:
As a workaround we're setting the calendar's currentYear and currentMonth on the onFocus event, but I think they should be kept automatically in sync with the control's value.
Expected behavior
Setting the date through the formControl should behave the same way as selecting a date from the calendar, so the currentMonth and year should be set.
eg.:
Angular version: 6.0
PrimeNG version: 6.0
Browser: [all]
Language: [all]
The text was updated successfully, but these errors were encountered: