Added an option to choose the date format: language based (as defined in each lang file) or ISO 8601 (YYYY-MM-DD).
This option can be set in Admin -> Settings. git-svn-id: http://redmine.rubyforge.org/svn/trunk@585 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -78,11 +78,16 @@ module ApplicationHelper
|
||||
end
|
||||
|
||||
def format_date(date)
|
||||
l_date(date) if date
|
||||
return nil unless date
|
||||
@date_format_setting ||= Setting.date_format.to_i
|
||||
@date_format_setting == 0 ? l_date(date) : date.strftime("%Y-%m-%d")
|
||||
end
|
||||
|
||||
def format_time(time)
|
||||
l_datetime((time.is_a? String) ? time.to_time : time) if time
|
||||
return nil unless time
|
||||
@date_format_setting ||= Setting.date_format.to_i
|
||||
time = time.to_time if time.is_a?(String)
|
||||
@date_format_setting == 0 ? l_datetime(time) : (time.strftime("%Y-%m-%d") + ' ' + l_time(time))
|
||||
end
|
||||
|
||||
def day_name(day)
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
<p><label><%= l(:setting_default_language) %></label>
|
||||
<%= select_tag 'settings[default_language]', options_for_select( lang_options_for_select(false), Setting.default_language) %></p>
|
||||
|
||||
<p><label><%= l(:setting_date_format) %></label>
|
||||
<%= select_tag 'settings[date_format]', options_for_select( [[l(:label_language_based), '0'], ['ISO 8601 (YYYY-MM-DD)', '1']], Setting.date_format) %></p>
|
||||
|
||||
<p><label><%= l(:setting_attachment_max_size) %></label>
|
||||
<%= text_field_tag 'settings[attachment_max_size]', Setting.attachment_max_size, :size => 6 %> KB</p>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user