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