From a405b48712344b160ac2be8dfcd4a862d48b8d45 Mon Sep 17 00:00:00 2001 From: Stefan Schlott Date: Tue, 27 Aug 2013 19:21:33 +0200 Subject: [PATCH] Fix timezones --- Rules | 1 + lib/eventhelpers.rb | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/Rules b/Rules index 72bda818..211bc92d 100644 --- a/Rules +++ b/Rules @@ -4,6 +4,7 @@ preprocess do expand_event_list("/_data/chaosevents/") expand_event_list("/_data/stammtisch/", "CCCS Stammtisch") calculate_to_dates + fix_timezones merge_location_data generate_event_pages generate_activity_pages diff --git a/lib/eventhelpers.rb b/lib/eventhelpers.rb index 38af752a..7fa1fa2c 100644 --- a/lib/eventhelpers.rb +++ b/lib/eventhelpers.rb @@ -41,3 +41,16 @@ def calculate_to_dates() end end +def fix_timezones() + items.each do |e| + if e[:created_at] && e[:created_at].instance_of?(Time) + e[:created_at] = e[:created_at].utc + end + if e[:startdate] && e[:startdate].instance_of?(Time) + e[:startdate] = e[:startdate].utc + end + if e[:enddate] && e[:enddate].instance_of?(Time) + e[:enddate] = e[:enddate].utc + end + end +end