Primeng: [minDate-maxDate] may not update in Calendar

Created on 3 Jan 2018  路  13Comments  路  Source: primefaces/primeng

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

defect

Most helpful comment

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.

All 13 comments

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

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

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.

How i can this fix?)

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.

Encountered the same issue. Following..

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

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

I can't replicate, here is my case;

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

Please replicate using the plunkr above

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.

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.

PR merged

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

garethlewis picture garethlewis  路  3Comments

Helayxa picture Helayxa  路  3Comments

lilling picture lilling  路  3Comments

watalberto picture watalberto  路  3Comments

markgoho picture markgoho  路  3Comments