module Icalendar::Values::BetterTimezones

Constants

WINDOWS_TZID_MAP

Public Instance Methods

tzinfo() click to toggle source
# File lib/synchrograph/icalendar_monkey_patches/better_timezones.rb, line 12
def tzinfo
  return time_zone.tzinfo if self.respond_to? :time_zone

  tzid = ical_params['tzid']
  tzid = tzid.first if tzid and tzid.any?

  if tzid
    return TZInfo::Timezone.get(WINDOWS_TZID_MAP[tzid]) if WINDOWS_TZID_MAP.has_key? tzid
    return TZInfo::Timezone.get(tzid) if TZInfo::Timezone.all_identifiers.include? tzid
  end

  return TZInfo::Timezone.get('Etc/UTC')
end
value_with_tz() click to toggle source
# File lib/synchrograph/icalendar_monkey_patches/better_timezones.rb, line 26
def value_with_tz
  ActiveSupportTimeWithZoneAdapter.new nil, tzinfo, value
end