File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 3
3
4
4
=begin
5
5
6
+ Tickle creates standard Ruby Time objects.
7
+
6
8
Time is ignored if there's also a date, unless the date is 'tomorrow'(?)
7
9
8
10
Tickle creates times in the servers local time zone.
9
11
To go from server time to user's local time...
10
12
user_time = server_time + (user_time_offset - server_time_offset)
11
13
eg (5:00PM Central) = (6:00PM Eastern + (-6 - -5))
12
14
15
+ Tickle makes 'May 30th' at 0:00, but 'June 18, 2011' and 'Christmas' at 12:00.
13
16
=end
14
17
15
18
16
19
server_offset = Time . now . utc_offset / 60 / 60
17
20
18
- [ 'May 30th at midnight ' , '6:30 PM' ,
21
+ [ 'May 30th' , '6:30 PM' ,
19
22
'tomorrow at 6:00' , 'June 18, 2011' , 'Christmas' ] . each { |s |
20
23
time = Tickle . parse ( s ) [ :next ]
24
+ if s == 'Christmas'
25
+ time -= 12 * 60 * 60
26
+ end
21
27
print s , " --> server date: " , time
22
28
puts
23
- print s , " --> utc date: " , time . utc
24
- puts
25
- }
29
+ }
You can’t perform that action at this time.
0 commit comments