Skip to content

DST change breaks the graph #3

@unpollito

Description

@unpollito

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions