fetrarij / ngx-daterangepicker-material

Pure Angular 2+ date range picker with material design theme, a demo here:
https://fetrarij.github.io/ngx-daterangepicker-material/
MIT License
246 stars 247 forks source link

When we click on Last 7 days or Last 14 days etc the days in the calendar are not highlighted. #416

Open GovindaPedhiwal opened 2 years ago

GovindaPedhiwal commented 2 years ago

Hi Team,

Actually I am working in project and using ngx-daterangepicker-material 2.4.2. so we can select dates and we have some options as well for example "Last 7 days", "Last 14 days" etc.

So the issue is in the latest version whenever we click on "Last 7 days" or "Last 14 days" so the dates in the calendar are not highlighted. The classes are not added in dates.

It was working fine in previous version because if condition was false and else part was executing and in the else part we were calling this.updateCalendars(); but the problem in that version was whenever we select filters counting was not coming propertly so someone added this.autoApply in If condition. Now counting is coming fine in latest version but in If condition we are not calling this.updateCalendars(); so could you please check and call this function inside If part also.

Here is the diff that solved my problem:


diff --git a/node_modules/ngx-daterangepicker-material/fesm2015/ngx-daterangepicker-material.js b/node_modules/ngx-daterangepicker-material/fesm2015/ngx-daterangepicker-material.js
index e7e82ed..0f9b003 100644
--- a/node_modules/ngx-daterangepicker-material/fesm2015/ngx-daterangepicker-material.js
+++ b/node_modules/ngx-daterangepicker-material/fesm2015/ngx-daterangepicker-material.js
@@ -940,6 +940,7 @@ let DaterangepickerComponent = DaterangepickerComponent_1 = class Daterangepicke
             this.rangeClicked.emit({ label: label, dates: dates });
             if (!this.keepCalendarOpeningWithRange || this.autoApply) {
                 this.clickApply();
+                this.updateCalendars();
             }
             else {
                 if (!this.alwaysShowCalendars) {
`
<img width="485" alt="impor" src="https://user-images.githubusercontent.com/29222029/150515996-c601eb52-6d4c-4da3-9dad-809a8ce049d4.PNG">
``
if we call this function inside if part then issue will be resolved.
<img width="519" alt="impor1" src="https://user-images.githubusercontent.com/29222029/150516470-55f1f5e3-6da0-4a5e-85df-8c60d88dc820.PNG">
YeomanWang commented 2 years ago

This issue still exist in the latest version. Seems like this change are not merged. @fetrarij