Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mchung/474188 to your computer and use it in GitHub Desktop.
Save mchung/474188 to your computer and use it in GitHub Desktop.
# Step one, check out code from http://code.google.com/p/google-rfc-2445/
# Step two, build the code: ant
# Step three, run this code with jruby
require 'jruby'
require "jars/rfc2445"
java_import "org.joda.time.LocalDate"
java_import "com.google.ical.compat.jodatime.LocalDateIteratorFactory"
start = LocalDate.new(2010, 1, 1)
ical = "RRULE:FREQ=MONTHLY;BYDAY=FR;BYMONTHDAY=13;COUNT=12"
LocalDateIteratorFactory.createLocalDateIterable(ical, start, true).each do |date|
puts date.toString("E, M-d-Y")
end
# Isn't it upsetting to discover that there's only one Friday the 13th in 2010?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment