Skip to content

Instantly share code, notes, and snippets.

View shad's full-sized avatar

Shad Reynolds shad

View GitHub Profile
@shad
shad / parse_date.rb
Created May 20, 2009 11:02
Ruby helper for parsing dates of an unknown format.
# ParseDate
#
# A helper for parsing dates of an unknown format.
#
# Takes a randomly formatted date and makes a best guess at the date, or throws and exception if
# there's no best guess. Will take international dates into account if you pass in a 'short form' date
# to help suggest a starting point for the search.
# Will also try Chronic parsing to get relative dates (yesterday, tomorrow, in 3 days, etc.)
#
# Examples: