Permalink
Browse files

Fix interval.range for DST.

  • Loading branch information...
1 parent 2045a75 commit 99ec34ac829a44af39058728f3869ef7a8b82d43 @jasondavies jasondavies committed May 8, 2013
Showing with 16 additions and 7 deletions.
  1. +3 −3 d3.js
  2. +1 −1 d3.min.js
  3. +3 −3 src/time/interval.js
  4. +9 −0 test/time/days-test.js
View
6 d3.js
@@ -8223,12 +8223,12 @@ d3 = function() {
return date - d0 < d1 - date ? d0 : d1;
}
function ceil(date) {
- date = local(new d3_time(date - 1));
- var t = +date, d;
+ var d0 = +date, d;
+ date = local(new d3_time(d0 - 1));
do {
step(date, 1);
d = local(date);
- } while (+d === t);
+ } while (d < d0);
return d;
}
function offset(date, k) {
View
2 d3.min.js
1 addition, 1 deletion not shown because the diff is too large. Please use a local Git client to view these changes.
View
6 src/time/interval.js
@@ -8,12 +8,12 @@ function d3_time_interval(local, step, number) {
}
function ceil(date) {
- date = local(new d3_time(date - 1));
- var t = +date, d;
+ var d0 = +date, d;
+ date = local(new d3_time(d0 - 1));
do {
step(date, 1);
d = local(date);
- } while (+d === t);
+ } while (d < d0);
return d;
}
View
9 test/time/days-test.js
@@ -47,6 +47,15 @@ suite.addBatch({
local(2011, 10, 8)
]);
},
+ "DST": time.dst(local(2014, 02, 28), local(2014, 02, 28, 01), function(range) {
+ assert.deepEqual(range(local(2014, 02, 26, 12), local(2014, 02, 31, 12)), [
+ local(2014, 02, 27),
+ local(2014, 02, 28, 01),
+ local(2014, 02, 29),
+ local(2014, 02, 30),
+ local(2014, 02, 31)
+ ]);
+ }),
"UTC": {
topic: function(range) {
return range.utc;

0 comments on commit 99ec34a

Please sign in to comment.