Skip to content

Commit e9155b2

Browse files
authored
Merge pull request danvk#985 from lmizinski/master
Fixes issue danvk#984 (Couldn't parse 20035000 as a date)
2 parents 27cee3f + 06e8ac8 commit e9155b2

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

auto_tests/tests/data_types.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* @fileoverview Test cases for DygraphOptions.
3+
*/
4+
5+
import Dygraph from '../../src/dygraph';
6+
7+
describe("dygraph-data-types", function() {
8+
9+
cleanupAfterEach();
10+
11+
var graph;
12+
13+
beforeEach(function() {
14+
graph = document.getElementById("graph");
15+
});
16+
17+
/*
18+
* Test to ensure ints are correctly interpreted as ints and not as dates
19+
*/
20+
it('testNumberOfData', function() {
21+
var opts = {
22+
width: 480,
23+
height: 320
24+
};
25+
var data = "x y\n" +
26+
"20033000 1\n" +
27+
"20034000 2\n" +
28+
"20035000 3\n" +
29+
"20036000 4";
30+
31+
var g = new Dygraph(graph, data, opts);
32+
assert.deepEqual(4, g.rawData_.length);
33+
});
34+
});

src/dygraph.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2608,10 +2608,7 @@ Dygraph.prototype.detectTypeFromString_ = function(str) {
26082608
str.indexOf('/') >= 0 ||
26092609
isNaN(parseFloat(str))) {
26102610
isDate = true;
2611-
} else if (str.length == 8 && str > '19700101' && str < '20371231') {
2612-
// TODO(danvk): remove support for this format.
2613-
isDate = true;
2614-
}
2611+
}
26152612

26162613
this.setXAxisOptions_(isDate);
26172614
};

0 commit comments

Comments
 (0)