[76] | 1 | require("./../../lib/env-js/envjs/node"); |
---|
| 2 | require("./../../d3"); |
---|
| 3 | require("./../../d3.time"); |
---|
| 4 | |
---|
| 5 | function parse(string) { return new Date(string); } |
---|
| 6 | function format(date) { return date.toString(); } |
---|
| 7 | |
---|
| 8 | console.log("hours(2011-01-01T06:00:00Z, 2011-01-01T10:00:00Z):"); |
---|
| 9 | d3.time.hours(parse("2011-01-01T06:00:00Z"), parse("2011-01-01T10:00:00Z")).forEach(log); |
---|
| 10 | console.log(""); |
---|
| 11 | |
---|
| 12 | console.log("hours(2011-03-13T07:00:00Z, 2011-03-13T11:00:00Z):"); |
---|
| 13 | d3.time.hours(parse("2011-03-13T07:00:00Z"), parse("2011-03-13T11:00:00Z")).forEach(log); |
---|
| 14 | console.log(""); |
---|
| 15 | |
---|
| 16 | console.log("hours(2011-11-06T07:00:00Z, 2011-11-06T11:00:00Z):"); |
---|
| 17 | d3.time.hours(parse("2011-11-06T07:00:00Z"), parse("2011-11-06T11:00:00Z")).forEach(log); |
---|
| 18 | console.log(""); |
---|
| 19 | |
---|
| 20 | console.log("hours(2011-11-06T07:00:00Z, 2011-11-07T11:00:00Z, 3):"); |
---|
| 21 | d3.time.hours(parse("2011-11-06T07:00:00Z"), parse("2011-11-07T11:00:00Z"), 3).forEach(log); |
---|
| 22 | console.log(""); |
---|
| 23 | |
---|
| 24 | console.log("hours.utc(2010-12-31T22:00:00Z, 2011-01-01T02:00:00Z):"); |
---|
| 25 | d3.time.hours.utc(parse("2010-12-31T22:00:00Z"), parse("2011-01-01T02:00:00Z")).forEach(log); |
---|
| 26 | console.log(""); |
---|
| 27 | |
---|
| 28 | console.log("hours.utc(2010-12-31T22:00:00Z, 2011-01-02T02:00:00Z, 3):"); |
---|
| 29 | d3.time.hours.utc(parse("2010-12-31T22:00:00Z"), parse("2011-01-02T02:00:00Z"), 3).forEach(log); |
---|
| 30 | console.log(""); |
---|
| 31 | |
---|
| 32 | function log(date) { |
---|
| 33 | console.log(" " + format(date)); |
---|
| 34 | } |
---|