Defect #5091 ยป i18n.rb.patch
i18n.rb (working copy) | ||
---|---|---|
37 | 37 | |
38 | 38 |
def format_date(date) |
39 | 39 |
return nil unless date |
40 |
Setting.date_format.blank? ? ::I18n.l(date.to_date) : date.strftime(Setting.date_format) |
|
40 |
time = date.to_time |
|
41 |
zone = User.current.time_zone |
|
42 |
local = zone ? time.in_time_zone(zone) : (time.utc? ? time.localtime : time) |
|
43 |
Setting.date_format.blank? ? ::I18n.l(local.to_date) : local.to_date.strftime(Setting.date_format) |
|
41 | 44 |
end |
42 | 45 |
|
43 | 46 |
def format_time(time, include_date = true) |
... | ... | |
45 | 48 |
time = time.to_time if time.is_a?(String) |
46 | 49 |
zone = User.current.time_zone |
47 | 50 |
local = zone ? time.in_time_zone(zone) : (time.utc? ? time.localtime : time) |
48 |
Setting.time_format.blank? ? ::I18n.l(local, :format => (include_date ? :default : :time)) : |
|
49 |
((include_date ? "#{format_date(time)} " : "") + "#{local.strftime(Setting.time_format)}") |
|
51 |
if Setting.time_format.blank? |
|
52 |
if include_date |
|
53 |
Setting.date_format.blank? ? |
|
54 |
::I18n.l(local, :format => :default) : |
|
55 |
local.strftime(Setting.date_format+' '+::I18n.t(:'time.formats.time')) |
|
56 |
else |
|
57 |
::I18n.l(local, :format => :time) |
|
58 |
end |
|
59 |
else |
|
60 |
if include_date |
|
61 |
Setting.date_format.blank? ? |
|
62 |
::I18n.l(local, :format => ::I18n.t(:'date.formats.default')+' '+Setting.time_format) : |
|
63 |
local.strftime(Setting.date_format+' '+Setting.time_format) |
|
64 |
else |
|
65 |
local.strftime(Setting.time_format) |
|
66 |
end |
|
67 |
end |
|
50 | 68 |
end |
51 | 69 | |
52 | 70 |
def day_name(day) |