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