active-icalendar-events 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/active-icalendar-events.rb +33 -13
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aec07e1857f72267287393b71a8d3cf600a8ad92814ef862c99b8693890e473e
|
4
|
+
data.tar.gz: 95720ab414ecd1df386c6f7c1c9f7664313c1efb3437b65d464616c18c9b3a68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf9a2bd544578257b52702aaaa71900116cf4a97ecc1b02e35a326d2550806350956fb4dcf17b5dd9e2ca66b8deef33e6a43197db8412a87198ba4f49aaaee76
|
7
|
+
data.tar.gz: ca6940f8a84da10a6f2c9477ee525507a105b8691afabc3e113999ab2b3584ddb8a95f918109cc6018d440fee7375c28dbb78242e49820f554bdd4c7b1de63b3
|
@@ -94,23 +94,48 @@ module ActiveIcalendarEvents
|
|
94
94
|
icalendar_data.first.events.map { |e|
|
95
95
|
event_start = e.dtstart
|
96
96
|
if event_start.is_a?(Icalendar::Values::Date)
|
97
|
-
timezone
|
97
|
+
timezone ||= ActiveSupport::TimeZone.new(e.parent.timezones.first.tzid.to_s)
|
98
98
|
event_start = timezone.local(event_start.year, event_start.month, event_start.day)
|
99
99
|
end
|
100
100
|
|
101
101
|
event_end = e.dtend
|
102
102
|
if event_end.is_a?(Icalendar::Values::Date)
|
103
|
-
timezone
|
103
|
+
timezone ||= ActiveSupport::TimeZone.new(e.parent.timezones.first.tzid.to_s)
|
104
104
|
event_end = timezone.local(event_end.year, event_end.month, event_end.day)
|
105
105
|
end
|
106
106
|
|
107
|
+
excluding_dates = e.exdate.map { |d|
|
108
|
+
if d.is_a?(Icalendar::Values::Date)
|
109
|
+
timezone ||= ActiveSupport::TimeZone.new(e.parent.timezones.first.tzid.to_s)
|
110
|
+
timezone.local(d.year, d.month, d.day)
|
111
|
+
else
|
112
|
+
d
|
113
|
+
end
|
114
|
+
}
|
115
|
+
|
116
|
+
recurrence_dates = e.rdate.map { |d|
|
117
|
+
if d.is_a?(Icalendar::Values::Date)
|
118
|
+
timezone ||= ActiveSupport::TimeZone.new(e.parent.timezones.first.tzid.to_s)
|
119
|
+
timezone.local(d.year, d.month, d.day)
|
120
|
+
else
|
121
|
+
d
|
122
|
+
end
|
123
|
+
}
|
124
|
+
|
125
|
+
e.rrule.each { |rrule|
|
126
|
+
if !rrule.until.nil?
|
127
|
+
timezone ||= ActiveSupport::TimeZone.new(e.parent.timezones.first.tzid.to_s)
|
128
|
+
rrule.until = timezone.parse(rrule.until)
|
129
|
+
end
|
130
|
+
}
|
131
|
+
|
107
132
|
{
|
108
133
|
name: e.summary,
|
109
134
|
event_start: event_start,
|
110
135
|
event_end: event_end,
|
111
136
|
recurrence_rule: e.rrule,
|
112
|
-
recurrence_dates:
|
113
|
-
excluding_dates:
|
137
|
+
recurrence_dates: recurrence_dates,
|
138
|
+
excluding_dates: excluding_dates,
|
114
139
|
recurrence_id: e.recurrence_id,
|
115
140
|
uid: e.uid
|
116
141
|
}
|
@@ -362,18 +387,13 @@ module ActiveIcalendarEvents
|
|
362
387
|
return name if is_event_active?(datetime, recurrence_event_start, recurrence_event_end)
|
363
388
|
}
|
364
389
|
|
365
|
-
until_datetime = nil
|
366
|
-
if !recurrence_rule.until.nil?
|
367
|
-
until_datetime = DateTime.parse(recurrence_rule.until)
|
368
|
-
end
|
369
|
-
|
370
390
|
case recurrence_rule.frequency
|
371
391
|
when "DAILY"
|
372
392
|
return name if is_daily_event_active_for_datetime?(
|
373
393
|
datetime,
|
374
394
|
event_start,
|
375
395
|
event_end,
|
376
|
-
|
396
|
+
recurrence_rule.until,
|
377
397
|
recurrence_rule.count,
|
378
398
|
recurrence_rule.interval.nil? ? 1 : recurrence_rule.interval,
|
379
399
|
excluding_dates,
|
@@ -384,7 +404,7 @@ module ActiveIcalendarEvents
|
|
384
404
|
datetime,
|
385
405
|
event_start,
|
386
406
|
event_end,
|
387
|
-
|
407
|
+
recurrence_rule.until,
|
388
408
|
recurrence_rule.count,
|
389
409
|
recurrence_rule.interval.nil? ? 1 : recurrence_rule.interval,
|
390
410
|
recurrence_rule.by_day,
|
@@ -396,7 +416,7 @@ module ActiveIcalendarEvents
|
|
396
416
|
datetime,
|
397
417
|
event_start,
|
398
418
|
event_end,
|
399
|
-
|
419
|
+
recurrence_rule.until,
|
400
420
|
recurrence_rule.count,
|
401
421
|
recurrence_rule.interval.nil? ? 1 : recurrence_rule.interval,
|
402
422
|
recurrence_rule.by_day,
|
@@ -409,7 +429,7 @@ module ActiveIcalendarEvents
|
|
409
429
|
datetime,
|
410
430
|
event_start,
|
411
431
|
event_end,
|
412
|
-
|
432
|
+
recurrence_rule.until,
|
413
433
|
recurrence_rule.count,
|
414
434
|
recurrence_rule.interval.nil? ? 1 : recurrence_rule.interval,
|
415
435
|
excluding_dates,
|