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("hour:"); |
---|
9 | console.log(" 2010-12-31T23:59:59Z -> " + format(d3.time.hour(parse("2010-12-31T23:59:59Z")))); |
---|
10 | console.log(" 2011-01-01T00:00:00Z -> " + format(d3.time.hour(parse("2011-01-01T00:00:00Z")))); |
---|
11 | console.log(" 2011-01-01T00:59:00Z -> " + format(d3.time.hour(parse("2011-01-01T00:59:00Z")))); |
---|
12 | console.log(" 2011-01-01T01:00:00Z -> " + format(d3.time.hour(parse("2011-01-01T01:00:00Z")))); |
---|
13 | console.log(" 2011-03-13T08:00:00Z -> " + format(d3.time.hour(parse("2011-03-13T08:00:00Z")))); |
---|
14 | console.log(" 2011-03-13T09:00:00Z -> " + format(d3.time.hour(parse("2011-03-13T09:00:00Z")))); |
---|
15 | console.log(" 2011-03-13T10:00:00Z -> " + format(d3.time.hour(parse("2011-03-13T10:00:00Z")))); |
---|
16 | console.log(" 2011-11-06T08:00:00Z -> " + format(d3.time.hour(parse("2011-11-06T08:00:00Z")))); |
---|
17 | console.log(" 2011-11-06T09:00:00Z -> " + format(d3.time.hour(parse("2011-11-06T09:00:00Z")))); |
---|
18 | console.log(" 2011-11-06T10:00:00Z -> " + format(d3.time.hour(parse("2011-11-06T10:00:00Z")))); |
---|
19 | console.log(""); |
---|
20 | |
---|
21 | var tz = process.env.TZ; |
---|
22 | try { |
---|
23 | process.env.TZ = "Asia/Kathmandu"; new Date().toString(); |
---|
24 | console.log("hour.npt:"); |
---|
25 | console.log(" 2010-12-31T23:59:59Z -> " + format(d3.time.hour(parse("2010-12-31T23:59:59Z")))); |
---|
26 | console.log(" 2011-01-01T00:00:00Z -> " + format(d3.time.hour(parse("2011-01-01T00:00:00Z")))); |
---|
27 | console.log(" 2011-01-01T00:59:00Z -> " + format(d3.time.hour(parse("2011-01-01T00:59:00Z")))); |
---|
28 | console.log(" 2011-01-01T01:00:00Z -> " + format(d3.time.hour(parse("2011-01-01T01:00:00Z")))); |
---|
29 | console.log(" 2011-03-13T08:00:00Z -> " + format(d3.time.hour(parse("2011-03-13T08:00:00Z")))); |
---|
30 | console.log(" 2011-03-13T09:00:00Z -> " + format(d3.time.hour(parse("2011-03-13T09:00:00Z")))); |
---|
31 | console.log(" 2011-03-13T10:00:00Z -> " + format(d3.time.hour(parse("2011-03-13T10:00:00Z")))); |
---|
32 | console.log(" 2011-11-06T08:00:00Z -> " + format(d3.time.hour(parse("2011-11-06T08:00:00Z")))); |
---|
33 | console.log(" 2011-11-06T09:00:00Z -> " + format(d3.time.hour(parse("2011-11-06T09:00:00Z")))); |
---|
34 | console.log(" 2011-11-06T10:00:00Z -> " + format(d3.time.hour(parse("2011-11-06T10:00:00Z")))); |
---|
35 | console.log(""); |
---|
36 | |
---|
37 | process.env.TZ = "Asia/Calcutta"; new Date().toString(); |
---|
38 | console.log("hour.ist:"); |
---|
39 | console.log(" 2010-12-31T23:59:59Z -> " + format(d3.time.hour(parse("2010-12-31T23:59:59Z")))); |
---|
40 | console.log(" 2011-01-01T00:00:00Z -> " + format(d3.time.hour(parse("2011-01-01T00:00:00Z")))); |
---|
41 | console.log(" 2011-01-01T00:59:00Z -> " + format(d3.time.hour(parse("2011-01-01T00:59:00Z")))); |
---|
42 | console.log(" 2011-01-01T01:00:00Z -> " + format(d3.time.hour(parse("2011-01-01T01:00:00Z")))); |
---|
43 | console.log(" 2011-03-13T08:00:00Z -> " + format(d3.time.hour(parse("2011-03-13T08:00:00Z")))); |
---|
44 | console.log(" 2011-03-13T09:00:00Z -> " + format(d3.time.hour(parse("2011-03-13T09:00:00Z")))); |
---|
45 | console.log(" 2011-03-13T10:00:00Z -> " + format(d3.time.hour(parse("2011-03-13T10:00:00Z")))); |
---|
46 | console.log(" 2011-11-06T08:00:00Z -> " + format(d3.time.hour(parse("2011-11-06T08:00:00Z")))); |
---|
47 | console.log(" 2011-11-06T09:00:00Z -> " + format(d3.time.hour(parse("2011-11-06T09:00:00Z")))); |
---|
48 | console.log(" 2011-11-06T10:00:00Z -> " + format(d3.time.hour(parse("2011-11-06T10:00:00Z")))); |
---|
49 | console.log(""); |
---|
50 | } finally { |
---|
51 | process.env.TZ = tz; |
---|
52 | } |
---|
53 | |
---|
54 | console.log("hour.utc:"); |
---|
55 | console.log(" 2010-12-31T23:59:59Z -> " + format(d3.time.hour.utc(parse("2010-12-31T23:59:59Z")))); |
---|
56 | console.log(" 2011-01-01T00:00:00Z -> " + format(d3.time.hour.utc(parse("2011-01-01T00:00:00Z")))); |
---|
57 | console.log(" 2011-01-01T00:59:00Z -> " + format(d3.time.hour.utc(parse("2011-01-01T00:59:00Z")))); |
---|
58 | console.log(" 2011-01-01T01:00:00Z -> " + format(d3.time.hour.utc(parse("2011-01-01T01:00:00Z")))); |
---|
59 | console.log(" 2011-03-13T08:00:00Z -> " + format(d3.time.hour.utc(parse("2011-03-13T08:00:00Z")))); |
---|
60 | console.log(" 2011-03-13T09:00:00Z -> " + format(d3.time.hour.utc(parse("2011-03-13T09:00:00Z")))); |
---|
61 | console.log(" 2011-03-13T10:00:00Z -> " + format(d3.time.hour.utc(parse("2011-03-13T10:00:00Z")))); |
---|
62 | console.log(" 2011-11-06T08:00:00Z -> " + format(d3.time.hour.utc(parse("2011-11-06T08:00:00Z")))); |
---|
63 | console.log(" 2011-11-06T09:00:00Z -> " + format(d3.time.hour.utc(parse("2011-11-06T09:00:00Z")))); |
---|
64 | console.log(" 2011-11-06T10:00:00Z -> " + format(d3.time.hour.utc(parse("2011-11-06T10:00:00Z")))); |
---|
65 | console.log(""); |
---|