File tree 1 file changed +16
-1
lines changed
1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ def self.schedule_from_ical(ical_string, options = {})
5
5
ical_string . each_line do |line |
6
6
( property , value ) = line . split ( ":" )
7
7
( property , tzid ) = property . split ( ";" )
8
- zone = Time . find_zone ( tzid ) if tzid . present?
8
+ zone = find_zone ( tzid ) if tzid . present?
9
9
case property
10
10
when "DTSTART"
11
11
value = { time : value , zone : zone } if zone . present?
@@ -92,5 +92,20 @@ def self.rule_from_ical(ical)
92
92
93
93
Rule . from_hash ( params )
94
94
end
95
+
96
+ private
97
+
98
+ def self . find_zone ( tzid )
99
+ ( _ , zone ) = tzid &.split ( "=" )
100
+ begin
101
+ Time . find_zone! ( zone ) if zone . present?
102
+ rescue ArgumentError
103
+ ( rails_zone , _tzinfo_id ) = ActiveSupport ::TimeZone ::MAPPING . find do |( k , _ ) |
104
+ Time . find_zone! ( k ) . now . strftime ( "%Z" ) == zone
105
+ end
106
+
107
+ Time . find_zone ( rails_zone )
108
+ end
109
+ end
95
110
end
96
111
end
You can’t perform that action at this time.
0 commit comments