Skip to content

Commit

Permalink
fix: Adapt changes from icalendar gem
Browse files Browse the repository at this point in the history
Closes: samg#163
  • Loading branch information
mralexandernickel authored and dechimp committed Jul 14, 2021
1 parent 087f81d commit 82fa3e9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
22 changes: 7 additions & 15 deletions lib/timetrap/formatters/ical.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,13 @@ def output
end

def initialize entries
entries.each do |e|
next unless e.end
calendar.event do

# hack around an issue in ical gem in ruby 1.9
unless respond_to? :<=>
def <=> other
dtstart > other.dtstart ? 1 : 0
end
end

dtstart DateTime.parse(e.start.to_s)
dtend DateTime.parse(e.end.to_s)
summary e.note
description e.note
entries.each do |entry|
next unless entry.end
calendar.event do |e|
e.dtstart = DateTime.parse(entry.start.to_s)
e.dtend = DateTime.parse(entry.end.to_s)
e.summary = entry.note
e.description = entry.note
end
end
calendar.publish
Expand Down
3 changes: 1 addition & 2 deletions spec/timetrap_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -783,9 +783,8 @@ def output
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:PUBLISH
PRODID:iCalendar-Ruby
PRODID:icalendar-ruby
BEGIN:VEVENT
SEQUENCE:0
DTEND:20081003T140000
SUMMARY:note
DTSTART:20081003T120000
Expand Down

0 comments on commit 82fa3e9

Please sign in to comment.