lib/run_ical.rb in run_ical-0.4.0 vs lib/run_ical.rb in run_ical-0.4.1
- old
+ new
@@ -23,10 +23,11 @@
def generate
description = @program.const_get(:DESCRIPTION)
data = @program.const_get(:DATA)
cal = Icalendar::Calendar.new
cal.x_wr_calname = "#{description} for #{@race_date}"
- start_date = @race_date - (data.size - 1).days
+ start_date_padding = @race_date.sunday? ? 1 : 2
+ start_date = @race_date - (data.size - start_date_padding).days
(start_date..@race_date).to_a.each.with_index do |date, index|
activity = data[index][:activity]
cal.event do |e|
e.dtstart = Icalendar::Values::Date.new(date)