-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-hour.js
More file actions
65 lines (60 loc) · 4.42 KB
/
Copy pathtest-hour.js
File metadata and controls
65 lines (60 loc) · 4.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
require("./../../lib/env-js/envjs/node");
require("./../../d3");
require("./../../d3.time");
function parse(string) { return new Date(string); }
function format(date) { return date.toString(); }
console.log("hour:");
console.log(" 2010-12-31T23:59:59Z -> " + format(d3.time.hour(parse("2010-12-31T23:59:59Z"))));
console.log(" 2011-01-01T00:00:00Z -> " + format(d3.time.hour(parse("2011-01-01T00:00:00Z"))));
console.log(" 2011-01-01T00:59:00Z -> " + format(d3.time.hour(parse("2011-01-01T00:59:00Z"))));
console.log(" 2011-01-01T01:00:00Z -> " + format(d3.time.hour(parse("2011-01-01T01:00:00Z"))));
console.log(" 2011-03-13T08:00:00Z -> " + format(d3.time.hour(parse("2011-03-13T08:00:00Z"))));
console.log(" 2011-03-13T09:00:00Z -> " + format(d3.time.hour(parse("2011-03-13T09:00:00Z"))));
console.log(" 2011-03-13T10:00:00Z -> " + format(d3.time.hour(parse("2011-03-13T10:00:00Z"))));
console.log(" 2011-11-06T08:00:00Z -> " + format(d3.time.hour(parse("2011-11-06T08:00:00Z"))));
console.log(" 2011-11-06T09:00:00Z -> " + format(d3.time.hour(parse("2011-11-06T09:00:00Z"))));
console.log(" 2011-11-06T10:00:00Z -> " + format(d3.time.hour(parse("2011-11-06T10:00:00Z"))));
console.log("");
var tz = process.env.TZ;
try {
process.env.TZ = "Asia/Kathmandu"; new Date().toString();
console.log("hour.npt:");
console.log(" 2010-12-31T23:59:59Z -> " + format(d3.time.hour(parse("2010-12-31T23:59:59Z"))));
console.log(" 2011-01-01T00:00:00Z -> " + format(d3.time.hour(parse("2011-01-01T00:00:00Z"))));
console.log(" 2011-01-01T00:59:00Z -> " + format(d3.time.hour(parse("2011-01-01T00:59:00Z"))));
console.log(" 2011-01-01T01:00:00Z -> " + format(d3.time.hour(parse("2011-01-01T01:00:00Z"))));
console.log(" 2011-03-13T08:00:00Z -> " + format(d3.time.hour(parse("2011-03-13T08:00:00Z"))));
console.log(" 2011-03-13T09:00:00Z -> " + format(d3.time.hour(parse("2011-03-13T09:00:00Z"))));
console.log(" 2011-03-13T10:00:00Z -> " + format(d3.time.hour(parse("2011-03-13T10:00:00Z"))));
console.log(" 2011-11-06T08:00:00Z -> " + format(d3.time.hour(parse("2011-11-06T08:00:00Z"))));
console.log(" 2011-11-06T09:00:00Z -> " + format(d3.time.hour(parse("2011-11-06T09:00:00Z"))));
console.log(" 2011-11-06T10:00:00Z -> " + format(d3.time.hour(parse("2011-11-06T10:00:00Z"))));
console.log("");
process.env.TZ = "Asia/Calcutta"; new Date().toString();
console.log("hour.ist:");
console.log(" 2010-12-31T23:59:59Z -> " + format(d3.time.hour(parse("2010-12-31T23:59:59Z"))));
console.log(" 2011-01-01T00:00:00Z -> " + format(d3.time.hour(parse("2011-01-01T00:00:00Z"))));
console.log(" 2011-01-01T00:59:00Z -> " + format(d3.time.hour(parse("2011-01-01T00:59:00Z"))));
console.log(" 2011-01-01T01:00:00Z -> " + format(d3.time.hour(parse("2011-01-01T01:00:00Z"))));
console.log(" 2011-03-13T08:00:00Z -> " + format(d3.time.hour(parse("2011-03-13T08:00:00Z"))));
console.log(" 2011-03-13T09:00:00Z -> " + format(d3.time.hour(parse("2011-03-13T09:00:00Z"))));
console.log(" 2011-03-13T10:00:00Z -> " + format(d3.time.hour(parse("2011-03-13T10:00:00Z"))));
console.log(" 2011-11-06T08:00:00Z -> " + format(d3.time.hour(parse("2011-11-06T08:00:00Z"))));
console.log(" 2011-11-06T09:00:00Z -> " + format(d3.time.hour(parse("2011-11-06T09:00:00Z"))));
console.log(" 2011-11-06T10:00:00Z -> " + format(d3.time.hour(parse("2011-11-06T10:00:00Z"))));
console.log("");
} finally {
process.env.TZ = tz;
}
console.log("hour.utc:");
console.log(" 2010-12-31T23:59:59Z -> " + format(d3.time.hour.utc(parse("2010-12-31T23:59:59Z"))));
console.log(" 2011-01-01T00:00:00Z -> " + format(d3.time.hour.utc(parse("2011-01-01T00:00:00Z"))));
console.log(" 2011-01-01T00:59:00Z -> " + format(d3.time.hour.utc(parse("2011-01-01T00:59:00Z"))));
console.log(" 2011-01-01T01:00:00Z -> " + format(d3.time.hour.utc(parse("2011-01-01T01:00:00Z"))));
console.log(" 2011-03-13T08:00:00Z -> " + format(d3.time.hour.utc(parse("2011-03-13T08:00:00Z"))));
console.log(" 2011-03-13T09:00:00Z -> " + format(d3.time.hour.utc(parse("2011-03-13T09:00:00Z"))));
console.log(" 2011-03-13T10:00:00Z -> " + format(d3.time.hour.utc(parse("2011-03-13T10:00:00Z"))));
console.log(" 2011-11-06T08:00:00Z -> " + format(d3.time.hour.utc(parse("2011-11-06T08:00:00Z"))));
console.log(" 2011-11-06T09:00:00Z -> " + format(d3.time.hour.utc(parse("2011-11-06T09:00:00Z"))));
console.log(" 2011-11-06T10:00:00Z -> " + format(d3.time.hour.utc(parse("2011-11-06T10:00:00Z"))));
console.log("");