File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 11require 'icalendar'
2+ require 'tzinfo'
23
34class ApiController < ApplicationController
45 protect_from_forgery with : :null_session
@@ -23,6 +24,13 @@ def uid
2324
2425 def events
2526 cal = Icalendar ::Calendar . new
27+ # Hint to clients (including Apple Calendar) that the calendar's canonical timezone is Europe/London
28+ cal . append_custom_property ( 'X-WR-CALNAME' , 'Newspeak House Events' )
29+ cal . append_custom_property ( 'X-WR-TIMEZONE' , 'Europe/London' )
30+
31+ # Provide a full VTIMEZONE definition for Europe/London to ensure correct DST handling
32+ london_tz = TZInfo ::Timezone . get ( 'Europe/London' )
33+ cal . add_timezone ( london_tz . ical_timezone ( Time . now ) )
2634
2735 Event . public_and_confirmed . each do |ev |
2836 cal . event do |e |
You can’t perform that action at this time.
0 commit comments