source: Dev/trunk/d3/test/time/test-second.js @ 76

Last change on this file since 76 was 76, checked in by fpvanagthoven, 14 years ago

d3

File size: 1.3 KB
Line 
1require("./../../lib/env-js/envjs/node");
2require("./../../d3");
3require("./../../d3.time");
4
5function parse(string) { return new Date(string); }
6function format(date) { return date.toString(); }
7
8console.log("second:");
9console.log("  2010-12-31T23:59:59.999Z -> " + format(d3.time.second(parse("2010-12-31T23:59:59.999Z"))));
10console.log("  2011-01-01T00:00:00.000Z -> " + format(d3.time.second(parse("2011-01-01T00:00:00.000Z"))));
11console.log("  2011-01-01T00:00:00.456Z -> " + format(d3.time.second(parse("2011-01-01T00:00:00.456Z"))));
12console.log("  2011-01-01T00:00:00.999Z -> " + format(d3.time.second(parse("2011-01-01T00:00:00.999Z"))));
13console.log("  2011-01-01T00:00:59.999Z -> " + format(d3.time.second(parse("2011-01-01T00:00:59.999Z"))));
14console.log("");
15
16console.log("second.utc:");
17console.log("  2010-12-31T23:59:59.999Z -> " + format(d3.time.second.utc(parse("2010-12-31T23:59:59.999Z"))));
18console.log("  2011-01-01T00:00:00.000Z -> " + format(d3.time.second.utc(parse("2011-01-01T00:00:00.000Z"))));
19console.log("  2011-01-01T00:00:00.456Z -> " + format(d3.time.second.utc(parse("2011-01-01T00:00:00.456Z"))));
20console.log("  2011-01-01T00:00:00.999Z -> " + format(d3.time.second.utc(parse("2011-01-01T00:00:00.999Z"))));
21console.log("  2011-01-01T00:00:59.999Z -> " + format(d3.time.second.utc(parse("2011-01-01T00:00:59.999Z"))));
22console.log("");
Note: See TracBrowser for help on using the repository browser.