File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 11require 'icalendar'
2+ require 'icalendar/tzinfo'
23require 'tzinfo'
34
45class ApiController < ApplicationController
@@ -45,10 +46,12 @@ def events
4546 end
4647
4748 # Add weekly Ration Club (Wednesdays, 7–10pm London time)
48- now_london = Time . now . in_time_zone ( 'Europe/London' )
49- days_until_wed = ( 3 - now_london . wday ) % 7
50- ration_start = ( now_london . to_date + days_until_wed ) . to_time . in_time_zone ( 'Europe/London' ) + 19 . hours
51- ration_end = ration_start + 3 . hours
49+ now_london = Time . zone . now . in_time_zone ( 'Europe/London' )
50+ days_until_wed = ( 3 - now_london . wday ) % 7
51+ wednesday = ( now_london + days_until_wed . days )
52+
53+ ration_start = wednesday . change ( hour : 19 , min : 0 , sec : 0 )
54+ ration_end = ration_start + 3 . hours
5255
5356 cal . event do |e |
5457 e . dtstart = Icalendar ::Values ::DateTime . new ( ration_start , tzid : 'Europe/London' )
You can’t perform that action at this time.
0 commit comments