Skip to content

Commit

Permalink
Use DateTime.parse for dates
Browse files Browse the repository at this point in the history
  • Loading branch information
elskwid committed Nov 8, 2009
1 parent 6fa059e commit 9921e70
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/eb_event.rb
Expand Up @@ -102,8 +102,8 @@ def parse_dates
# dates[3] = end day and date
# dates[4] = end time
# dates[5] = time zone
@start = Time.parse("#{dates[1].strip} #{dates[2].strip}")
@end = Time.parse("#{dates[3].strip} #{dates[4].strip}")
@start = DateTime.parse("#{dates[1].strip} #{dates[2].strip}")
@end = DateTime.parse("#{dates[3].strip} #{dates[4].strip}")
else
# don't know this format
@start = ""
Expand Down
6 changes: 6 additions & 0 deletions test/eb_event_test.rb
Expand Up @@ -54,4 +54,10 @@ def test_start
def test_end
assert_equal "2009-11-11T22:00:00+00:00", entry.end.to_s
end

def test_split_dates
last = Brical::EbEvent.new(feed.entries.last)
assert_equal "2009-11-28T20:00:00+00:00", last.start.to_s
assert_equal "2009-11-29T00:00:00+00:00", last.end.to_s
end
end

0 comments on commit 9921e70

Please sign in to comment.