greatCodeIdeas / md-date-range-picker

Angular Material Date Range Picker Service/Directive
MIT License
62 stars 40 forks source link

Crashing on firefox and safari #27

Closed danillocesar closed 6 years ago

danillocesar commented 7 years ago

Just open the demo page on those browser and you will see..

Any quick fix for that?

roelbarreto commented 7 years ago

@danillocesar Works fine on my firefox Windows, I have no mac yet to test it but I'll find a way to test on Mac Safari/Firefox image

danillocesar commented 7 years ago

That's weird. Here's what happens on my firefox and on my clients. ff

It takes a lot of time to load then firefox ask me to shut it down because some script is taking too long to run, probably in some kinda of a infinite loop.

roelbarreto commented 7 years ago

I'll Investigate it

danillocesar commented 7 years ago

I'm in Brazil, if that helps. From what i've seen, its on a method that change the time of the calendar.. its possiblem that the region is interfering?

roelbarreto commented 7 years ago

@danillocesar Can you execute this script on your firefox then post the log result here?

function getFirstDayOfWeek() {
    return 1;
} 
var currentDate = new Date(),
                monthStartDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), 1),
                monthEndDate = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 0),
                calendarStartDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), 1 - (monthStartDate.getDay() == 0 ? 6 : (monthStartDate.getDay() - getFirstDayOfWeek()))),
                calendarEndDate = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 7 - (monthEndDate.getDay() - getFirstDayOfWeek())),
                calendar = calendarStartDate;

console.log(calendar, calendarEndDate);
danillocesar commented 7 years ago

Date 2017-08-28T03:00:00.000Z Date 2017-10-02T03:00:00.000Z

That's the result

roelbarreto commented 7 years ago

Got similar issue on Brazil timezone https://discussions.apple.com/thread/2715555?tstart=0 I'll continue investigating this Thanks @danillocesar

roelbarreto commented 7 years ago

@danillocesar A recent release related to your issue has been addressed, can you verify on demo page if still having the existing issue? https://ipiz.herokuapp.com/md-date-range-picker-demo/index.html

danillocesar commented 7 years ago

@ipiz same problem, line is 334 while (calendar < calendarEndDate) { dates.push(calendar); calendar = new Date(calendar.getFullYear(), calendar.getMonth(), calendar.getDate() + 1); }

roelbarreto commented 6 years ago

@danillocesar could you try another shot testing https://ipiz.herokuapp.com/md-date-range-picker-demo/index.html on your browser? I updated the demo to use the latest build i mate which limit the loop for possible infinite loop.

Regards...

danillocesar commented 6 years ago

@ipiz yes, its not crashing now.. can i update my project with the new build?

roelbarreto commented 6 years ago

I can publish a new release with the fix 0.6.3

roelbarreto commented 6 years ago

You can now update your dependency version to 0.6.3 or get the latest build Regards...