Format date in user's prefered format by default

This commit is contained in:
Holger Just 2012-07-02 21:08:48 +02:00
parent eea550e639
commit 17793c87e3
1 changed files with 15 additions and 0 deletions

View File

@ -64,6 +64,21 @@ module ChiliProject
count.to_i > 0 ? array[(count.to_i * -1)..-1] : []
end
end
def date(input, format=nil)
if format.nil?
return "" unless input
if Setting.date_format.blank?
input = super(input, '%Y-%m-%d')
return ::I18n.l(input.to_date) if input.respond_to?(:to_date)
input # default return value
else
super(input, Setting.date_format)
end
else
super
end
end
end
module Filters