Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/redmine/i18n.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ def ll(lang, str, value=nil)

def format_date(date)
return nil unless date
Setting.date_format.blank? ? ::I18n.l(date.to_date, :count => date.strftime('%d')) : date.strftime(Setting.date_format)
date = date.to_time if date.is_a?(String)
Setting.date_format.blank? ? ::I18n.l(date, :count => date.strftime('%d')) : date.strftime(Setting.date_format)
end

def format_time(time, include_date = true)
Expand Down
1 change: 1 addition & 0 deletions test/unit/lib/redmine/i18n_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def test_date_format
today = Date.today
Setting.date_format = '%d %m %Y'
assert_equal today.strftime('%d %m %Y'), format_date(today)
assert_equal today.strftime('%d %m %Y'), format_date(today.to_s)
end

def test_date_and_time_for_each_language
Expand Down