Format date in user's prefered format by default

This commit is contained in:
Holger Just 2012-07-02 21:08:48 +02:00 committed by Kolan Sh
parent 5350f4323a
commit 8e80e65e0a
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