You might take a look at date3.rb (part of the date2 package).