From d5a7c319ac2c9068f847c7d05fd392b9cc42824a Mon Sep 17 00:00:00 2001 From: Alex Dilley Date: Mon, 20 Jun 2016 16:30:28 +0100 Subject: [PATCH] iCal spec defines UNTIL as either a date or date-time. Support for rules with UNTIL part set as a date, avoiding coercion into a Time in the system time zone. https://tools.ietf.org/html/rfc5545#section-3.3.10 --- lib/ice_cube/parsers/ical_parser.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ice_cube/parsers/ical_parser.rb b/lib/ice_cube/parsers/ical_parser.rb index 2e1e2f05..7387a9ca 100644 --- a/lib/ice_cube/parsers/ical_parser.rb +++ b/lib/ice_cube/parsers/ical_parser.rb @@ -37,7 +37,11 @@ def self.rule_from_ical(ical) when 'COUNT' params[:count] = value.to_i when 'UNTIL' - params[:until] = Time.parse(value).utc + params[:until] = if value =~ /^\d{8}$/ + Date.parse(value).to_datetime.to_time + else + Time.parse(value) + end.utc when 'WKST' params[:wkst] = TimeUtil.ical_day_to_symbol(value) when 'BYSECOND'