Skip to content
Browse files

Added ActiveSupport's Time#to_datetime

  • Loading branch information...
1 parent 0c6439c commit ba397a4a843f73caab5224682cffc0286080ecd7 @sunny sunny committed Dec 14, 2008
Showing with 8 additions and 2 deletions.
  1. +8 −2 git-ics.rb
View
10 git-ics.rb
@@ -9,14 +9,20 @@
require 'icalendar'
require 'grit'
+class Time
+ def to_datetime
+ DateTime.civil(year, month, day, hour, min, sec, Rational(utc_offset, 86400))
+ end
+end
+
def git_to_ical(dir)
repo = Grit::Repo.new(dir)
cal = Icalendar::Calendar.new
repo.commits.each do |commit|
cal.event do
- dtstart commit.committed_date
- dtend commit.committed_date
+ dtstart commit.committed_date.to_datetime
+ dtend commit.committed_date.to_datetime
summary "Commit by #{commit.author}"
description commit.message
uid commit.id

0 comments on commit ba397a4

Please sign in to comment.
Something went wrong with that request. Please try again.