cccs-website/scripts/generate-stammtisch.rb
Stefan Schlott e94ddcb4ca Finally fix timezone desaster
All UTC times will be converted to local time.
No need for tzinfo, etc.

Bear in mind to use UTC times in events for simplified input!
2013-08-28 12:28:44 +02:00

35 lines
697 B
Ruby
Executable file

#!/usr/bin/env ruby
# encoding: utf-8
require 'date'
require 'yaml'
def event(day, dayoffset, location)
startDate = Time.local(day.year, day.month, day.day + dayoffset, 18, 0, 0)
{
'startdate' => startDate,
'duration' => '4h',
'location' => {
'location' => location
}
}
end
year=ARGV[0].to_i
result = { 'events' => [] }
for month in 1..12
date = Date.new(year,month,1)
firsttuesday = if (date.wday<=2)
date + (2-date.wday)
else
date + (9-date.wday)
end
result['events'] << event(firsttuesday, 0, 'zadu')
result['events'] << event(firsttuesday, 15, 'shack')
end
puts result.to_yaml