Skip to content

Instantly share code, notes, and snippets.

@dcparker
Created October 7, 2009 02:12
Show Gist options
  • Save dcparker/203666 to your computer and use it in GitHub Desktop.
Save dcparker/203666 to your computer and use it in GitHub Desktop.
# Adjusts Google Calendar ical times for TimeZone ONLY WHEN NECESSARY
tzadjust = Time.gcalschema("#{e["DTSTART;TZID=#{self.time_zone_name}"] || "#{e['DTSTART;VALUE=DATE']}T000000"}Z").nil? ? -4*3600 : 0
st = (Time.gcalschema("#{e["DTSTART;TZID=#{self.time_zone_name}"] || "#{e['DTSTART;VALUE=DATE']}T000000"}Z") || Time.gcalschema(e['DTSTART'])) + tzadjust
et = (Time.gcalschema("#{e["DTEND;TZID=#{self.time_zone_name}"] || "#{e['DTEND;VALUE=DATE']}T000000"}Z") || Time.gcalschema(e['DTEND'])) + tzadjust
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment