Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DST change breaks the graph #3

Open
unpollito opened this issue Oct 26, 2015 · 0 comments
Open

DST change breaks the graph #3

unpollito opened this issue Oct 26, 2015 · 0 comments

Comments

@unpollito
Copy link

Hi,

After last Sunday's DST change in Europe, the graph seems to be broken for me:

http://i.imgur.com/nNPj6zo.png

When the history entry number 25 is evaluated in the loop between lines 587 and 611 in mathmagician.js, I've got a nextDate value of 1445814000000 and a hist.date value of 1445817600000 (that is, hist.date is one hour more than nextDate, courtesy of the DST change). These values cause the code to execute both the for statement in line 590 and the if in line 598, which adds two 25s to the graph, one of them with value 0.

A quick fix would be to change the condition in the for statement to observe a maximum difference of one hour, e.g. "dt < hist.date - millisecondsPerDay/24" instead of "dt < hist.date"; I've tested this and the output is what we'd normally expect. However, there might be more issues with date/time management, and so a more resilient solution would be to store only dates in YYYYMMDD format instead of timestamps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant