lib/rrule.rb in jruby-rfc2445-0.1.0 vs lib/rrule.rb in jruby-rfc2445-0.5.0
- old
+ new
@@ -1,10 +1,12 @@
require 'java'
require File.dirname(__FILE__) + '/rfc2445.jar'
class RRule
include_class('com.google.ical.values.RRule'){|package,name| "J#{name}" }
+ include_class('com.google.ical.values.DateTimeValue')
+ include_class('com.google.ical.values.DateValue')
RRULE = 'RRULE'
EXRULE = 'EXRULE'
VEVENT = 'VEVENT'
@@ -219,13 +221,20 @@
wday = Weekday::MAP[wday.to_s.downcase]
@rrule.setWkSt(wday)
self
end
- # Gets the end date
+ # Gets the end date, assume it is UTC for now
def until
d = @rrule.getUntil
- d ? JTime.local(d.year, d.month, d.day, d.hour, d.minute, d.second) : nil
+ case d
+ when DateTimeValue
+ JTime.from_date_time_value(d)
+ when DateValue
+ JTime.from_date_value(d)
+ else
+ nil
+ end
end
# Sets the end date
#
# ==== Options
\ No newline at end of file