primeng icon indicating copy to clipboard operation
primeng copied to clipboard

[minDate-maxDate] may not update in Calendar

Open lucifer-AM opened this issue 8 years ago • 13 comments

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

lucifer-AM avatar Jan 03 '18 10:01 lucifer-AM

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

connectingbussiness avatar Jan 04 '18 05:01 connectingbussiness

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

skormel avatar Jan 04 '18 07:01 skormel

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.

yanjunze avatar Jan 08 '18 08:01 yanjunze

How i can this fix?)

devoutsoft avatar Jan 11 '18 13:01 devoutsoft

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.

juanmag4 avatar Jan 12 '18 16:01 juanmag4

Encountered the same issue. Following..

rishuvaid avatar Jan 12 '18 21:01 rishuvaid

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

AndreMantas avatar Jan 15 '18 14:01 AndreMantas

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

JPecko avatar Jan 15 '18 14:01 JPecko

I can't replicate, here is my case;

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

Please replicate using the plunkr above

cagataycivici avatar Mar 05 '18 11:03 cagataycivici

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 avatar Mar 05 '18 13:03 connectingbussiness

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.

connectingbussiness avatar Mar 05 '18 14:03 connectingbussiness

PR merged

cagataycivici avatar Mar 05 '18 14:03 cagataycivici

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.

shinde-prasad avatar Aug 06 '19 14:08 shinde-prasad