X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Fdate_formats.js;h=5148fe7fb6a84a34a79ec50d174749bf9a177019;hb=refs%2Ftags%2Fv2.0.0;hp=d15567b2562b02ac34e791fdef3b14075c1829da;hpb=89fdcedbda6906d90e15d84285c4f6c0b8d96d28;p=dygraphs.git diff --git a/auto_tests/tests/date_formats.js b/auto_tests/tests/date_formats.js index d15567b..5148fe7 100644 --- a/auto_tests/tests/date_formats.js +++ b/auto_tests/tests/date_formats.js @@ -3,13 +3,10 @@ * * @author dan@dygraphs.com (Dan Vanderkam) */ -describe("date-formats", function() { -beforeEach(function() { -}); +import * as utils from '../../src/dygraph-utils'; -afterEach(function() { -}); +describe("date-formats", function() { it('testISO8601', function() { // Format: YYYY-MM-DDTHH:MM:SS.ddddddZ @@ -19,7 +16,7 @@ it('testISO8601', function() { // Firefox <4 does not support this format: // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/parse if (navigator.userAgent.indexOf("Firefox/3.5") == -1) { - assert.equal(946816496789, Dygraph.dateParser("2000-01-02T12:34:56.789012Z")); + assert.equal(946816496789, utils.dateParser("2000-01-02T12:34:56.789012Z")); } }); @@ -36,7 +33,15 @@ it('testHyphenatedDate', function() { zp(d.getDate()) + ' ' + zp(d.getHours()) + ':' + zp(d.getMinutes()); - assert.equal(Date.UTC(2000, 1, 2), Dygraph.dateParser(str)); + assert.equal(Date.UTC(2000, 1, 2), utils.dateParser(str)); +}); + +it('testMillisecondsDate', function() { + // Format: YYYY-MM-DD HH:MM:SS.MS + + // Midnight February 2, 2000 14:25:42.123 UTC + var ts = Date.UTC(2000, 1, 2, 14, 25, 42, 123); + assert.equal("2000/02/02 14:25:42.123", utils.dateString_(ts, true)); }); });