icalendar 2.1.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +4 -0
- data/lib/icalendar/tzinfo.rb +11 -3
- data/lib/icalendar/version.rb +1 -1
- data/spec/tzinfo_spec.rb +26 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 961c1bb54f8d041206166d436da335415ffa8373
|
4
|
+
data.tar.gz: 559c04b6e5456b74649baf53db4c60d2dd2f2485
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0e4f2ee01e35b88c0d8916f7a17bd441338b6eda24aba19ab4e78c6cbf25b4bf2614fa94e82c1e085b9cf4bd006a863d690e17234c05aad0a670bc883f97534
|
7
|
+
data.tar.gz: db81643632c9054fcc1595d344949cd36848b7c3c5dea2fccced3322069320dde48c7ece037f6087025df04719b86b62fe369a1f34fbfb7a1c59107b2bbeac9a
|
data/History.txt
CHANGED
data/lib/icalendar/tzinfo.rb
CHANGED
@@ -56,13 +56,21 @@ module Icalendar
|
|
56
56
|
offset.ical_offset
|
57
57
|
end
|
58
58
|
|
59
|
+
def offset_abbreviation
|
60
|
+
offset.abbreviation.to_s
|
61
|
+
end
|
62
|
+
|
59
63
|
def rrule
|
60
64
|
start = local_start.to_datetime
|
61
65
|
# this is somewhat of a hack, but seems to work ok
|
66
|
+
# assumes that no timezone transition is in law as "4th X of the month"
|
67
|
+
# but only as 1st X, 2nd X, 3rd X, or Last X
|
68
|
+
start_week = ((start.day - 1) / 7).to_i + 1
|
69
|
+
start_week = (start_week > 3) ? -1 : start_week
|
62
70
|
[sprintf(
|
63
71
|
'FREQ=YEARLY;BYMONTH=%d;BYDAY=%d%s',
|
64
72
|
start.month,
|
65
|
-
|
73
|
+
start_week,
|
66
74
|
start.strftime('%a').upcase[0,2]
|
67
75
|
)]
|
68
76
|
end
|
@@ -129,7 +137,7 @@ module TZInfo
|
|
129
137
|
day.dtstart = start_transition.dtstart
|
130
138
|
day.rrule = start_transition.rrule unless end_transition.nil?
|
131
139
|
else
|
132
|
-
day.tzname =
|
140
|
+
day.tzname = end_transition.offset_abbreviation
|
133
141
|
day.tzoffsetfrom = end_transition.offset_from
|
134
142
|
day.tzoffsetto = end_transition.offset_to
|
135
143
|
day.dtstart = end_transition.dtstart
|
@@ -141,7 +149,7 @@ module TZInfo
|
|
141
149
|
def standard
|
142
150
|
Icalendar::Timezone::Standard.new.tap do |std|
|
143
151
|
if dst?
|
144
|
-
std.tzname =
|
152
|
+
std.tzname = end_transition.offset_abbreviation
|
145
153
|
std.tzoffsetfrom = end_transition.offset_from
|
146
154
|
std.tzoffsetto = end_transition.offset_to
|
147
155
|
std.dtstart = end_transition.dtstart
|
data/lib/icalendar/version.rb
CHANGED
data/spec/tzinfo_spec.rb
CHANGED
@@ -4,7 +4,7 @@ require_relative '../lib/icalendar/tzinfo'
|
|
4
4
|
describe 'TZInfo::Timezone' do
|
5
5
|
|
6
6
|
let(:tz) { TZInfo::Timezone.get 'Europe/Copenhagen' }
|
7
|
-
let(:date) { DateTime.new
|
7
|
+
let(:date) { DateTime.new 2014 }
|
8
8
|
subject { tz.ical_timezone date }
|
9
9
|
|
10
10
|
describe 'daylight offset' do
|
@@ -17,6 +17,14 @@ describe 'TZInfo::Timezone' do
|
|
17
17
|
specify { expect(subject.standards.first.tzoffsetfrom.value_ical).to eq "+0200" }
|
18
18
|
end
|
19
19
|
|
20
|
+
describe 'daylight recurrence rule' do
|
21
|
+
specify { expect(subject.daylights.first.rrule.first.value_ical).to eq "FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3" }
|
22
|
+
end
|
23
|
+
|
24
|
+
describe 'standard recurrence rule' do
|
25
|
+
specify { expect(subject.standards.first.rrule.first.value_ical).to eq "FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10" }
|
26
|
+
end
|
27
|
+
|
20
28
|
describe 'no end transition' do
|
21
29
|
let(:tz) { TZInfo::Timezone.get 'America/Cayman' }
|
22
30
|
let(:date) { DateTime.now }
|
@@ -82,4 +90,21 @@ END:VTIMEZONE
|
|
82
90
|
end
|
83
91
|
end
|
84
92
|
|
93
|
+
describe 'tzname for offset' do
|
94
|
+
# Check for CET/CEST correctness, which doesn't follow
|
95
|
+
# the more common *ST/*DT style abbreviations.
|
96
|
+
let(:tz) { TZInfo::Timezone.get 'Europe/Prague' }
|
97
|
+
let(:ical_tz) { tz.ical_timezone date }
|
98
|
+
|
99
|
+
describe '#daylight' do
|
100
|
+
subject(:tzname) { ical_tz.daylights.first.tzname.first }
|
101
|
+
it { should eql 'CEST' }
|
102
|
+
end
|
103
|
+
|
104
|
+
describe '#standard' do
|
105
|
+
subject(:tzname) { ical_tz.standards.first.tzname.first }
|
106
|
+
it { should eql 'CET' }
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
85
110
|
end
|
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.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Ahearn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|