npm-stat.com
npm-stat.com copied to clipboard
Chart tooltip is one day back
See https://npm-stat.com/charts.html?package=ajv or https://npm-stat.com/charts.html?package=ajv&from=2017-04-01&to=2017-04-16
Particularly on the second one you can see that the date one the axis is correct and in the tooltip (when you mouse-over the dot on the chart) it is one day back
Yep, I know this issue. It has been introduced in PR #37, but I didn't recognize it before deploying that change and didn't feel like it's that important.
I guess it is caused by some timezone problem. Can you tell me in which timezone you tested this behavior?
In GMT (UTC +1 now)
looks fixed
Are you still in UTC+1? Because I haven't changed the calculation, I think.
Maybe it’s because it’s UTC now...
That sounds likely.
I am in Eastern Time, I'm seeing an issue on the default view for a package where the both the "To" field and the date in the graph is always the day before (ie if today is June 2nd, both are June 1st). IMHO it should give data for the current day even if the day is not over.
Looks like the bug appears in a chart generation. The plain API stat is correct while the chart lies
@ozzyogkush
IMHO it should give data for the current day even if the day is not over.
npm-stat.com cannot give numbers before a day is over, since NPM starts calculating the numbers on midnight UTC.
@vlzhr Yes, everything is fine in the back end, but time zones in JavaScript are awful. Highcharts uses Date
objects for displaying the x-axis and 2019-09-23T00:00:00Z might be displayed as Sunday, Sep 22, 2019 (the actual time is omitted) if your offset from UTC is negative.
looks like this is linked to the issue I just opened #83 where I noticed the timezone moving forwards has caused it to duplicate a date and going back has caused it to skip a date. This results in the graph appearing as above.