Format date in user's prefered format by default
This commit is contained in:
parent
5350f4323a
commit
8e80e65e0a
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue