source: Dev/branches/rest-dojo-ui/Demo/d3/test/time/test-day.js @ 312

Last change on this file since 312 was 312, checked in by jkraaijeveld, 13 years ago
File size: 1.2 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("day:");
9console.log("  2011-01-01T07:59:59Z -> " + format(d3.time.day(parse("2011-01-01T07:59:59Z"))));
10console.log("  2011-01-01T08:00:00Z -> " + format(d3.time.day(parse("2011-01-01T08:00:00Z"))));
11console.log("  2011-01-01T08:00:01Z -> " + format(d3.time.day(parse("2011-01-01T08:00:01Z"))));
12console.log("  2011-03-13T09:00:00Z -> " + format(d3.time.day(parse("2011-03-13T09:00:00Z"))));
13console.log("  2011-11-06T09:00:00Z -> " + format(d3.time.day(parse("2011-11-06T09:00:00Z"))));
14console.log("");
15
16console.log("day.utc:");
17console.log("  2010-12-31T23:59:59Z -> " + format(d3.time.day.utc(parse("2010-12-31T23:59:59Z"))));
18console.log("  2011-01-01T00:00:00Z -> " + format(d3.time.day.utc(parse("2011-01-01T00:00:00Z"))));
19console.log("  2011-01-01T23:00:00Z -> " + format(d3.time.day.utc(parse("2011-01-01T23:00:00Z"))));
20console.log("  2011-03-13T09:00:00Z -> " + format(d3.time.day.utc(parse("2011-03-13T09:00:00Z"))));
21console.log("  2011-11-06T09:00:00Z -> " + format(d3.time.day.utc(parse("2011-11-06T09:00:00Z"))));
22console.log("");
Note: See TracBrowser for help on using the repository browser.