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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
desc: date/time api (#977)
tests:
# Type shims -- see shim.yaml
- def: rt1 = 1375147296.6812
- def: t1 = r.epoch_time(rt1)
- def: t2 = r.epoch_time(rt1 + 1000)
# Arithmetic
- cd: (t1 + 1000).to_epoch_time()
js: t1.add(1000).toEpochTime()
ot: (1375148296.681)
- cd: (t1 - 1000).to_epoch_time()
js: t1.sub(1000).toEpochTime()
ot: (1375146296.681)
- cd: (t1 - (t1 - 1000))
js: t1.sub(t1.sub(1000))
ot: 1000
# Comparisons
- cd: (t1 < t1)
js: t1.lt(t1)
ot: false
- cd: (t1 <= t1)
js: t1.le(t1)
ot: true
- cd: (t1.eq(t1))
py: (t1 == t1)
ot: true
- cd: (t1.ne(t1))
py: (t1 != t1)
ot: false
- cd: (t1 >= t1)
js: t1.ge(t1)
ot: true
- cd: (t1 > t1)
js: t1.gt(t1)
ot: false
- cd: (t1 < t2)
js: t1.lt(t2)
ot: true
- cd: (t1 <= t2)
js: t1.le(t2)
ot: true
- cd: (t1.eq(t2))
py: (t1 == t2)
ot: false
- cd: (t1.ne(t2))
py: (t1 != t2)
ot: true
- cd: (t1 >= t2)
js: t1.ge(t2)
ot: false
- cd: (t1 > t2)
js: t1.gt(t2)
ot: false
# Predicates
- cd: t1.during(t1, t1 + 1000)
js: t1.during(t1, t1.add(1000))
ot: true
- rb: t1.during(t1, t1 + 1000, :left_bound => :open)
py: t1.during(t1, t1 + 1000, left_bound='open')
js: t1.during(t1, t1.add(1000), {leftBound:'open'})
ot: false
- cd: t1.during(t1, t1)
ot: false
- rb: t1.during(t1, t1, :right_bound => :closed)
py: t1.during(t1, t1, right_bound='closed')
js: t1.during(t1, t1, {rightBound:'closed'})
ot: true
# Time Zone Manipulation -- see timezones.yaml
# Portion Retrieval
- cd: t1.date().to_epoch_time()
ot: 1375142400
- cd: t1.time_of_day()
ot: (4896.681)
- cd: t1.year()
ot: 2013
- cd: t1.month()
ot: 7
- cd: t1.day()
ot: 30
- cd: t1.day_of_week()
ot: 2
- cd: t1.day_of_year()
ot: 211
- cd: t1.hours()
ot: 1
- cd: t1.minutes()
ot: 21
- cd: t1.seconds()
ot: 36.681
# Construction/Conversion
- cd: r.time(2013, r.july, 29, 23, 30, 0.1, "-07:00").to_epoch_time()
ot: (1375165800.1)
- cd: r.time(2013, r.july, 29, 23, 30, 0.1, "-07:00").timezone()
ot: ("-07:00")
- cd: r.time(2013, r.july, 29, 23, 30, 0.1).to_epoch_time()
ot: err("ReqlQueryLogicError", "Got 6 arguments to TIME (expected 4 or 7).", [])
- cd: r.time(2013, r.july, 29, 23, 30, 0.1).timezone()
ot: err("ReqlQueryLogicError", "Got 6 arguments to TIME (expected 4 or 7).", [])
- cd: r.time(2013, r.july, 29, 23, 30).to_epoch_time()
ot: err("ReqlQueryLogicError", "Got 5 arguments to TIME (expected 4 or 7).", [])
- cd: r.time(2013, r.july, 29, 23).to_epoch_time()
ot: err("ReqlQueryLogicError", "Expected type STRING but found NUMBER.", [])
- cd: r.time(2013, r.july, 29, "-07:00").to_epoch_time()
ot: 1375081200
- cd: r.time(2013, r.july, 29, "-07:00").timezone()
ot: ("-07:00")
- cd: r.time(2013, r.july, 29).to_epoch_time()
ot: err("ReqlCompileError", "Expected between 4 and 7 arguments but found 3.", [])
- cd: r.time(2013, r.july, 29).timezone()
ot: err("ReqlCompileError", "Expected between 4 and 7 arguments but found 3.", [])
- cd: r.iso8601("2013-07-30T20:56:05-07:00").to_epoch_time()
js: r.ISO8601("2013-07-30T20:56:05-07:00").to_epoch_time()
ot: 1375242965
- cd: r.epoch_time(1375242965).in_timezone("-07:00").to_iso8601()
js: r.epochTime(1375242965).inTimezone("-07:00").toISO8601()
ot: ("2013-07-30T20:56:05-07:00")
- cd: r.now().type_of()
ot: ("PTYPE<TIME>")
- cd: (r.now() - r.now())
js: r.now().sub(r.now())
ot: 0
# Default Time Zones
- cd: r.iso8601("2013-07-30T20:56:05").to_iso8601()
js: r.ISO8601("2013-07-30T20:56:05").toISO8601()
ot: err("ReqlQueryLogicError", "ISO 8601 string has no time zone, and no default time zone was provided.", [])
- cd: r.iso8601("2013-07-30T20:56:05", :default_timezone => '-07').to_iso8601()
py: r.iso8601("2013-07-30T20:56:05", default_timezone='-07').to_iso8601()
js: r.ISO8601("2013-07-30T20:56:05", {"default_timezone":"-07"}).toISO8601()
ot: ("2013-07-30T20:56:05-07:00")
- cd: r.expr([r.monday, r.tuesday, r.wednesday, r.thursday, r.friday, r.saturday, r.sunday])
ot: ([1, 2, 3, 4, 5, 6, 7])
- cd: r.expr([r.january, r.february, r.march, r.april, r.may, r.june,
r.july, r.august, r.september, r.october, r.november, r.december])
ot: ([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
|