ruby on rails - All day event icalendar gem -
i using below setup event export ical icalendar gem.
@calendar = icalendar::calendar.new event = icalendar::event.new event.dtstart = ev.start_at.strftime("%y%m%d") event.dtend = ev.end_at.strftime("%y%m%d") event.summary = ev.summary @calendar.add
in order make event day needs this:
dtstart;value=date:20101117 dtend;value=date:20101119
right using
event.dtstart = "$value=date:"+ev.start_at.strftime("%y%m%d")"
this output
dtstart:$value=date:20101117
and replace ":$" ";" with
@allday = @calendar.to_ical.gsub(":$", ";")
is there more direct way save dates day?
i played around , figured out 1 way. can assign properties event dates, in form of key-value pairs. assign value property so:
event = icalendar::event.new event.dtstart = date.new(2010,12,1) event.dtstart.ical_params = { "value" => "date" } puts event.to_ical # output begin:vevent dtstamp:20101201t230134 dtstart;value=date:20101201 sequence:0 uid:2010-12-01t23:01:34-08:00_923426206@ubuntu end:vevent
now fun part. given calendar can create event , pass in block initializes date properties:
calendar.event dtstart date.new(2010,11,17), ical_params = {"value"=>"date"} dtend date.new(2010,11,19), ical_params = {"value"=>"date"} end
Comments
Post a Comment