Skip to content

One Day Off on Daylight Saving Time #203

@high42

Description

@high42

First of all, congratulations on this awesome library :)

To begin, I am working with Mexico's CST (Central Stanard Time) and CDT (Central Daylight Time) which you can see here.

The problem I ran into was that when a task starts before the timezone change in spring (April 3rd) the end date (to) is one day short. I found the problem to be when looping through the values of each data element and setting a row in the Fill the Chart section.

So each time a bar is created we have the following line of code:

_bar = core.createProgressBar(dl, day);

That means that dl (duration) sets the width of the bar with the following line of code:

dl = Math.round((cTo - cFrom) / tools.getCellSize()) + 1;

However, for a specific case (default case in switch) the calculation is the following:

dl = Math.floor((dTo - dFrom) / UTC_DAY_IN_MS) + 1;

In this specific case, the Math.floor function is taking for example a 12.958333333333334 to a 12. So the solution for this specific case would be to use Math.Round();

I wanted to post this here to see why we're rounding down in that specific case. What does it aim to do? I don't know if using Math.Round() will mess with something else...

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