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

[minDate-maxDate] may not update in Calendar #4755

Closed
lucifer-AM opened this issue Jan 3, 2018 · 13 comments
Closed

[minDate-maxDate] may not update in Calendar #4755

lucifer-AM opened this issue Jan 3, 2018 · 13 comments
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@lucifer-AM
Copy link

lucifer-AM commented Jan 3, 2018

PrimeNG@v[4.3.0].

Hi,
I am facing an issue in p-calendar tag as I am not able to update the [minDate] of the p-calendar component.

The scenario is as follows:-

I have two p-calendar tags in my DOM.

First one is used to set the [minDate] of the second p-calendar tag.

The [minDate] only reflects after I try to write something on the second p-calendar input tag.

I think the second p-calendar component does not update the [minDate] after the [minDate] model changes. It is taking the previously set [minDate] until the component is updated from the DOM.

Awaiting reply.

Thank you @cagataycivici

@connectingbussiness
Copy link

I had got the same issue the p-calender validations is not updating until i change the month.

@skormel
Copy link

skormel commented Jan 4, 2018

I have the same issue validations are not updated until I change the month.

@yanjunze
Copy link

yanjunze commented Jan 8, 2018

I found in the source code there is some follow judge code:
if(this.currentMonth && this.currentYear) { // refresh the minDate or maxDate UI. }
But in January this.currentMonth===0 so it can't refresh the UI immediately.
Forgive my poor English.

@devoutsoft
Copy link

How i can this fix?)

@juanmag4
Copy link

You can change the source code for a temporary fix until someone in primeng fix it. Something like this:
if ((this.currentMonth != undefined || this.currentMonth != null) && this.currentYear) { }
Nice catch @yanjunze .
Also, sorry for my bad English.

@rishuvaid
Copy link

Encountered the same issue. Following..

@AndreMantas
Copy link

+1 same use case, same problem. Works after changing the month.

@JPecko
Copy link

JPecko commented Jan 15, 2018

Works after changing and choose other month.
+1 same use case, same problem.

Aask added a commit to Aask/primeng that referenced this issue Jan 16, 2018
A fix for the issue discussed in primefaces#4755. 

A case where the previous code doesn´t work is if minDate currentMonth is January, i.e. 0.
@cagataycivici cagataycivici self-assigned this Mar 5, 2018
@cagataycivici cagataycivici changed the title [minDate] not updating in p-calendar when trying to set multiple times. [minDate-maxDate] may not update in Calendar Mar 5, 2018
@cagataycivici cagataycivici added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Mar 5, 2018
@cagataycivici cagataycivici added this to the 5.2.1 milestone Mar 5, 2018
@cagataycivici
Copy link
Member

I can't replicate, here is my case;

http://plnkr.co/edit/SCe6pwFbTayipI2EU1g9?p=preview

Please replicate using the plunkr above

@cagataycivici cagataycivici removed this from the 5.2.1 milestone Mar 5, 2018
@connectingbussiness
Copy link

This issue arises when the current month must be january. In all other cases it works.
I mean when u make change in the month of January it doesn't work.

@connectingbussiness
Copy link

I want to explain above issue in breif.
Think that today's date is 01/01/2018.
Now if we select from date as 04/01/2018
And if we select to date in the same month for example 09/01/2018. In this case the date validation failed. Remaining all the cases it worked.

@cagataycivici
Copy link
Member

PR merged

@cagataycivici cagataycivici added this to the 5.2.1 milestone Mar 5, 2018
@shinde-prasad
Copy link

shinde-prasad commented Aug 6, 2019

image

@cagataycivici
PLease see the above image, I am using primeng p-calendar and adding minDate, maxDate,showOtherMonths,selectOtherMonths,monthNavigator,yearNavigator,yearRange
as TRUE. I am getting those year offset selected between lets say 1954 to 2010 in year range but months selection is shown as disabled.

Now if I click on next arrow button and go till December then it comes directly to year 2020.

I am confused about this weird behaviour.

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