Created
July 13, 2010 17:15
-
-
Save mchung/474188 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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