Skip to content

Instantly share code, notes, and snippets.

@aiwilliams
Created January 26, 2011 18:22
Show Gist options
  • Save aiwilliams/797158 to your computer and use it in GitHub Desktop.
Save aiwilliams/797158 to your computer and use it in GitHub Desktop.
common_formats = {
:at => lambda do |time|
fmt = time.strftime("%I:%M%p").downcase.sub(":00", "")
fmt =~ /^0/ ? fmt.sub("0", "") : fmt
end
}
common_formats.each do |name, format|
Date::DATE_FORMATS[name] = format
Time::DATE_FORMATS[name] = format
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment