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

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

d3

File size: 1.2 KB
RevLine 
[76]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("year:");
9console.log("  2011-01-01T07:59:59Z -> " + format(d3.time.year(parse("2011-01-01T07:59:59Z"))));
10console.log("  2011-01-01T08:00:00Z -> " + format(d3.time.year(parse("2011-01-01T08:00:00Z"))));
11console.log("  2011-01-01T08:00:01Z -> " + format(d3.time.year(parse("2011-01-01T08:00:01Z"))));
12console.log("  2011-03-13T09:00:00Z -> " + format(d3.time.year(parse("2011-03-13T09:00:00Z"))));
13console.log("  2011-11-06T09:00:00Z -> " + format(d3.time.year(parse("2011-11-06T09:00:00Z"))));
14console.log("");
15
16console.log("year.utc:");
17console.log("  2010-12-31T23:59:59Z -> " + format(d3.time.year.utc(parse("2010-12-31T23:59:59Z"))));
18console.log("  2011-01-01T00:00:00Z -> " + format(d3.time.year.utc(parse("2011-01-01T00:00:00Z"))));
19console.log("  2011-01-01T23:00:00Z -> " + format(d3.time.year.utc(parse("2011-01-01T23:00:00Z"))));
20console.log("  2011-03-13T09:00:00Z -> " + format(d3.time.year.utc(parse("2011-03-13T09:00:00Z"))));
21console.log("  2011-11-06T09:00:00Z -> " + format(d3.time.year.utc(parse("2011-11-06T09:00:00Z"))));
22console.log("");
Note: See TracBrowser for help on using the repository browser.