twinssbc / Ionic-Calendar

A calendar directive for Ionic framework
http://twinssbc.github.io/Ionic-Calendar/demo
MIT License
159 stars 73 forks source link

DST bug #161

Open kas84 opened 7 years ago

kas84 commented 7 years ago

Hi, I am facing this issue where my I have an event on november 1st (when seeing it from monthview on october) that makes the event seem like two (I am guessing due to DST)

Debugging the code, I see that timeDifferenceStart is 37.083333333333336 and timeDifferenceEnd is 38.04165509259259.

index is Math.floor of timeDifferenceStart so 37. timeDifferenceEnd - eps is 38.040655092592594

so when iterating like this...

while (index < timeDifferenceEnd - eps) 

And that it's why it's two days instead of one as it should be.

So what is eps and why is eps=0.001 on monthview?

twinssbc commented 7 years ago

@kas84 eps is for handling the number precision. Because in JavaScript, it's common to get below result 0.2 + 0.4 = 0.6000000000000001 It will leads to not equal result. That's why I use eps. May I know what's your startTime, endTime and time zone?