From: Adam Vartanian Date: Wed, 11 Apr 2012 18:56:38 +0000 (-0400) Subject: Always set milliseconds to zero when computing date tick placement, so that resulting... X-Git-Tag: v1.0.0~272^2~2 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=002aa329110806d35c228a650f872bf06f3f2dbf;p=dygraphs.git Always set milliseconds to zero when computing date tick placement, so that resulting times are exactly aligned and become dates when at 00:00. --- diff --git a/dygraph-tickers.js b/dygraph-tickers.js index 41e60e4..b331de8 100644 --- a/dygraph-tickers.js +++ b/dygraph-tickers.js @@ -330,7 +330,7 @@ Dygraph.getDateAxis = function(start_time, end_time, granularity, opts, dg) { // Find a time less than start_time which occurs on a "nice" time boundary // for this granularity. var g = spacing / 1000; - var d = new Date(start_time); + var d = new Date(start_time).setMilliseconds(0); var x; if (g <= 60) { // seconds x = d.getSeconds(); d.setSeconds(x - x % g);