icalendar 2.5.0 → 2.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +3 -0
- data/lib/icalendar/timezone.rb +2 -2
- data/lib/icalendar/values/date_time.rb +4 -0
- data/lib/icalendar/values/time_with_zone.rb +7 -2
- data/lib/icalendar/version.rb +1 -1
- data/spec/roundtrip_spec.rb +8 -8
- data/spec/tzinfo_spec.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a5b21473741cf53f97e0855df7898df74760fd9c4941dea1a9876cb91dfdc95
|
4
|
+
data.tar.gz: 743ad24dbf1057eee1a676c3de5184a52e481d5c88a8d96bb16bccb8fc002a12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e139149e08d9d8bc25dfb0fd03a6e0e029ecfc31112751128f2f020767207ee8b17b2d9e000f9197dbca0650171836e1ef5c470e8f613684ba6dea88013dda6
|
7
|
+
data.tar.gz: 4a9ff7fcdc3f81b9252cef04f8211a90e71142b94e093b2b95dcbf15b631b576fbcd5ef937cb38ba62a94e22565d8d6f8583b42ceee34d51fc8e42de139ca932
|
data/History.txt
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
=== 2.5.1 2018-10-30
|
2
|
+
* Fix usage without ActiveSupport installed.
|
3
|
+
|
1
4
|
=== 2.5.0 2018-09-10
|
2
5
|
* Set timezone information from VTIMEZONE components in cases that ActiveSupport can't figure it out (or isn't installed)
|
3
6
|
* Prevent rewinding the Parser IO input during parsing - Niels Laukens
|
data/lib/icalendar/timezone.rb
CHANGED
@@ -75,7 +75,7 @@ module Icalendar
|
|
75
75
|
|
76
76
|
def standard_for(local)
|
77
77
|
possible = standards.map do |std|
|
78
|
-
schedule = IceCube::Schedule.new(std.dtstart) do |s|
|
78
|
+
schedule = IceCube::Schedule.new(std.dtstart.to_time) do |s|
|
79
79
|
std.rrule.each do |rule|
|
80
80
|
s.add_recurrence_rule IceCube::Rule.from_ical(rule.value_ical)
|
81
81
|
end
|
@@ -90,7 +90,7 @@ module Icalendar
|
|
90
90
|
|
91
91
|
def daylight_for(local)
|
92
92
|
possible = daylights.map do |day|
|
93
|
-
schedule = IceCube::Schedule.new(day.dtstart) do |s|
|
93
|
+
schedule = IceCube::Schedule.new(day.dtstart.to_time) do |s|
|
94
94
|
day.rrule.each do |rule|
|
95
95
|
s.add_recurrence_rule IceCube::Rule.from_ical(rule.value_ical)
|
96
96
|
end
|
@@ -19,14 +19,19 @@ module Icalendar
|
|
19
19
|
params = Icalendar::DowncasedHash(params)
|
20
20
|
@tz_utc = params['tzid'] == 'UTC'
|
21
21
|
|
22
|
-
offset_value =
|
22
|
+
offset_value = unless params['tzid'].nil?
|
23
23
|
tzid = params['tzid'].is_a?(::Array) ? params['tzid'].first : params['tzid']
|
24
24
|
if defined?(ActiveSupport::TimeZone) &&
|
25
25
|
defined?(ActiveSupportTimeWithZoneAdapter) &&
|
26
26
|
(tz = ActiveSupport::TimeZone[tzid])
|
27
27
|
ActiveSupportTimeWithZoneAdapter.new(nil, tz, value)
|
28
28
|
elsif (tz = TimezoneStore.retrieve(tzid))
|
29
|
-
|
29
|
+
offset = tz.offset_for_local(value).to_s
|
30
|
+
if value.respond_to?(:change)
|
31
|
+
value.change offset: offset
|
32
|
+
else
|
33
|
+
::Time.new(value.year, value.month, value.day, value.hour, value.min, value.sec, offset)
|
34
|
+
end
|
30
35
|
end
|
31
36
|
end
|
32
37
|
super((offset_value || value), params)
|
data/lib/icalendar/version.rb
CHANGED
data/spec/roundtrip_spec.rb
CHANGED
@@ -81,18 +81,18 @@ describe Icalendar do
|
|
81
81
|
it 'sorts time events by start time' do
|
82
82
|
events = subject.sort_by(&:dtstart)
|
83
83
|
|
84
|
-
expect(events.first.dtstart).to eq ::DateTime.new(2014, 7, 14, 9, 0, 0, '-4')
|
84
|
+
expect(events.first.dtstart.to_datetime).to eq ::DateTime.new(2014, 7, 14, 9, 0, 0, '-4')
|
85
85
|
|
86
|
-
expect(events.last.dtstart).to eq ::DateTime.new(2014, 7, 14, 9, 1, 0, '-4')
|
87
|
-
expect(events.last.dtend).to eq ::DateTime.new(2014, 7, 14, 9, 59, 0, '-4')
|
86
|
+
expect(events.last.dtstart.to_datetime).to eq ::DateTime.new(2014, 7, 14, 9, 1, 0, '-4')
|
87
|
+
expect(events.last.dtend.to_datetime).to eq ::DateTime.new(2014, 7, 14, 9, 59, 0, '-4')
|
88
88
|
end
|
89
89
|
|
90
90
|
it 'sorts time events by end time' do
|
91
91
|
events = subject.sort_by(&:dtend)
|
92
92
|
|
93
|
-
expect(events.first.dtstart).to eq ::DateTime.new(2014, 7, 14, 9, 1, 0, '-4')
|
94
|
-
expect(events.first.dtend).to eq ::DateTime.new(2014, 7, 14, 9, 59, 0, '-4')
|
95
|
-
expect(events.last.dtstart).to eq ::DateTime.new(2014, 7, 14, 9, 0, 0, '-4')
|
93
|
+
expect(events.first.dtstart.to_datetime).to eq ::DateTime.new(2014, 7, 14, 9, 1, 0, '-4')
|
94
|
+
expect(events.first.dtend.to_datetime).to eq ::DateTime.new(2014, 7, 14, 9, 59, 0, '-4')
|
95
|
+
expect(events.last.dtstart.to_datetime).to eq ::DateTime.new(2014, 7, 14, 9, 0, 0, '-4')
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
@@ -103,8 +103,8 @@ describe Icalendar do
|
|
103
103
|
it 'sorts time events' do
|
104
104
|
events = subject.sort_by(&:dtstart)
|
105
105
|
|
106
|
-
expect(events.first.dtstart).to eq ::Date.new(2014, 7, 14)
|
107
|
-
expect(events.last.dtstart).to eq ::DateTime.new(2014, 7, 14, 9, 0, 0, '-4')
|
106
|
+
expect(events.first.dtstart.to_date).to eq ::Date.new(2014, 7, 14)
|
107
|
+
expect(events.last.dtstart.to_datetime).to eq ::DateTime.new(2014, 7, 14, 9, 0, 0, '-4')
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
data/spec/tzinfo_spec.rb
CHANGED
@@ -29,12 +29,13 @@ describe 'TZInfo::Timezone' do
|
|
29
29
|
let(:tz) { TZInfo::Timezone.get 'Asia/Shanghai' }
|
30
30
|
let(:date) { DateTime.now }
|
31
31
|
|
32
|
+
# TODO only run this test with tzinfo ≥ 1.0
|
32
33
|
it 'only creates a standard component' do
|
33
34
|
expect(subject.to_ical).to eq <<-EXPECTED.gsub "\n", "\r\n"
|
34
35
|
BEGIN:VTIMEZONE
|
35
36
|
TZID:Asia/Shanghai
|
36
37
|
BEGIN:STANDARD
|
37
|
-
DTSTART:
|
38
|
+
DTSTART:19910915T010000
|
38
39
|
TZOFFSETFROM:+0900
|
39
40
|
TZOFFSETTO:+0800
|
40
41
|
TZNAME:CST
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: icalendar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Ahearn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ice_cube
|