Skip to content

Instantly share code, notes, and snippets.

@altamic
Created February 9, 2009 14:19
Show Gist options
  • Save altamic/60801 to your computer and use it in GitHub Desktop.
Save altamic/60801 to your computer and use it in GitHub Desktop.
initializer "time_formats.rb",
%q{def quarter(month)
(((month - 1) / 3) + 1) if (1..12).member? month
end
ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS[:quarter] = lambda { |time| time.strftime("Q#{quarter(time.month)}-%y") }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment