diff --git a/Rules b/Rules
index dd52ef74..72bda818 100644
--- a/Rules
+++ b/Rules
@@ -3,6 +3,7 @@
preprocess do
expand_event_list("/_data/chaosevents/")
expand_event_list("/_data/stammtisch/", "CCCS Stammtisch")
+ calculate_to_dates
merge_location_data
generate_event_pages
generate_activity_pages
diff --git a/content/_data/chaosevents.yaml b/content/_data/chaosevents.yaml
index f3ba05ab..5d2b1825 100644
--- a/content/_data/chaosevents.yaml
+++ b/content/_data/chaosevents.yaml
@@ -3,7 +3,7 @@ events:
-
#kind: event
startdate: 2013-09-06
- duration: 2d
+ duration: 3d
title: "MRMCD2013 - Security Advice"
url: http://mrmcd.net/
location:
@@ -15,7 +15,7 @@ events:
#public: true
-
startdate: 2013-12-27
- duration: 3d
+ duration: 4d
title: "30C3"
url: https://events.ccc.de/
location:
diff --git a/content/sidebar.html b/content/sidebar.html
index 212d4b8d..ed26171f 100644
--- a/content/sidebar.html
+++ b/content/sidebar.html
@@ -9,7 +9,15 @@ if (upcomingEvents.size>0)
<% upcomingEvents[0..9].each do |e| %>
-
- <%= e[:startdate].strftime("%d.%m.") %>
+ <% if e[:startdate].instance_of?(Date) %>
+ <% if e[:startdate]
+ <%= e[:startdate].strftime("%d.%m.") %> - <%= e[:enddate].strftime("%d.%m.") %>:
+ <% else %>
+ <%= e[:startdate].strftime("%d.%m.") %>:
+ <% end %>
+ <% else %>
+ <%= e[:startdate].strftime("%d.%m., %H:%M") %>:
+ <% end %>
<% if e[:url] %><%= e[:title] %><% else %><%= e[:title] %><% end %>
<% end %>
diff --git a/lib/eventhelpers.rb b/lib/eventhelpers.rb
index 68a81eb7..38af752a 100644
--- a/lib/eventhelpers.rb
+++ b/lib/eventhelpers.rb
@@ -24,3 +24,20 @@ def get_public_events()
items.select { |i| (i[:kind]=='event') && i[:public] }
end
+def calculate_to_dates()
+ items.select { |i| (i[:kind]=='event') && i[:duration] }.each do |e|
+ if e[:startdate].instance_of?(Date)
+ if e[:duration] =~ /(\d+)d/
+ e[:enddate] = e[:startdate] + ($1.to_i - 1)
+ end
+ else
+ if e[:duration] =~ /(\d+)h/
+ e[:enddate] = e[:startdate] + 60*60*$1.to_i
+ end
+ if e[:duration] =~ /(\d+)m/
+ e[:enddate] = e[:startdate] + 60*$1.to_i
+ end
+ end
+ end
+end
+