[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("years(2009-11-21T06:00:00Z, 2012-02-12T10:00:00Z):"); |
---|
| 9 | d3.time.years(parse("2009-11-21T06:00:00Z"), parse("2012-02-12T10:00:00Z")).forEach(log); |
---|
| 10 | console.log(""); |
---|
| 11 | |
---|
| 12 | console.log("years(2009-01-02T07:00:00Z, 2012-04-24T11:00:00Z):"); |
---|
| 13 | d3.time.years(parse("2009-01-02T07:00:00Z"), parse("2012-04-24T11:00:00Z")).forEach(log); |
---|
| 14 | console.log(""); |
---|
| 15 | |
---|
| 16 | console.log("years(2009-09-25T07:00:00Z, 2012-12-17T11:00:00Z):"); |
---|
| 17 | d3.time.years(parse("2009-09-25T07:00:00Z"), parse("2012-12-17T11:00:00Z")).forEach(log); |
---|
| 18 | console.log(""); |
---|
| 19 | |
---|
| 20 | console.log("years(2009-09-25T07:00:00Z, 2042-12-17T11:00:00Z, 5):"); |
---|
| 21 | d3.time.years(parse("2009-09-25T07:00:00Z"), parse("2042-12-17T11:00:00Z"), 5).forEach(log); |
---|
| 22 | console.log(""); |
---|
| 23 | |
---|
| 24 | console.log("years.utc(2009-11-20T22:00:00Z, 2012-02-12T02:00:00Z):"); |
---|
| 25 | d3.time.years.utc(parse("2009-11-20T22:00:00Z"), parse("2012-02-12T02:00:00Z")).forEach(log); |
---|
| 26 | console.log(""); |
---|
| 27 | |
---|
| 28 | console.log("years.utc(2009-11-20T22:00:00Z, 2012-02-42T02:00:00Z, 5):"); |
---|
| 29 | d3.time.years.utc(parse("2009-11-20T22:00:00Z"), parse("2042-02-12T02:00:00Z"), 5).forEach(log); |
---|
| 30 | console.log(""); |
---|
| 31 | |
---|
| 32 | function log(date) { |
---|
| 33 | console.log(" " + format(date)); |
---|
| 34 | } |
---|