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 UI does not update in some cases #4775

Closed
designus opened this issue Jan 8, 2018 · 5 comments
Closed

Calendar UI does not update in some cases #4775

designus opened this issue Jan 8, 2018 · 5 comments
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@designus
Copy link

designus commented Jan 8, 2018

There is no guarantee in receiving a response in GitHub Issue Tracker, If you'd like to secure our response, you may consider PrimeNG PRO Support where support is provided within 4 business hours

I'm submitting a ... (check one with "x")

[X] bug report => Search github for a similar issue or PR before submitting

Plunkr Case (Bug Reports)
http://plnkr.co/edit/okzYh53odGHzV5zOjWgf?p=preview

Current behavior
Calendar UI is not updated when disabledDays input property is changed. Calendar UI is only updated when some event is triggered manually (e.g: click on next month)

Expected behavior
Calendar UI should update whenever input props are changed.

Minimal reproduction of the problem with instructions
Toggle disabledDays on and off and check calendar UI.

Please tell us about your environment:

  • Angular version: 4.1.3
  • PrimeNG version: 4.3.0
    Same problem occurs in the most recent versions as well. Check plunk link.

Other info
It seems that the problem lies within this line:
https://github.com/primefaces/primeng/blob/master/src/app/components/calendar/calendar.ts#L386
"this.currentMonth" is zero based. So if we are in January, "this.currentMonth" value is 0 which results in condition being false.

@ppsdang
Copy link

ppsdang commented Jan 16, 2018

I am also getting this issue while setting minDate. because set minDate is also checking current month which in case of january is zero.

@designus
Copy link
Author

In my case, as a temporary solution until this is fixed I added ChangeDetectorRef class detectChanges() method after setting disabledDays property.

@jbreitenbach
Copy link
Contributor

jbreitenbach commented Jan 17, 2018

@designus I'm not seeing that adding

.detectChanges(); 

has any effect.
However, changing the month seems to work and this only seems to happen for dates in January.

If you init your plunker with new Date('02/13/2018'); instead of new Date(); the code works as you would expect

jbreitenbach added a commit to jbreitenbach/primeng that referenced this issue Jan 17, 2018
jbreitenbach added a commit to jbreitenbach/primeng that referenced this issue Jan 17, 2018
@designus
Copy link
Author

Yes you are right, it is only for the first month of the year. Thanks for the fix.

@cagataycivici cagataycivici self-assigned this Jan 22, 2018
@cagataycivici cagataycivici added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Jan 22, 2018
@cagataycivici cagataycivici added this to the 5.2.0-RC2 milestone Jan 22, 2018
@cagataycivici cagataycivici changed the title Calendar UI does not update if disabledDays property is updated Calendar UI does not update in some cases Jan 22, 2018
@cagataycivici
Copy link
Member

Cases are minDate, maxDate, disabledDays and disabledDates

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

4 participants