Feature #21421 » 0000-Add-optional-user-parameter-to-I18n-format_time-to-o.patch
| lib/redmine/i18n.rb | ||
|---|---|---|
| 71 | 71 |
::I18n.l(date.to_date, options) |
| 72 | 72 |
end |
| 73 |
def format_time(time, include_date = true) |
|
| 73 |
def format_time(time, include_date = true, user = nil)
|
|
| 74 | 74 |
return nil unless time |
| 75 | 75 |
options = {}
|
| 76 | 76 |
options[:format] = (Setting.time_format.blank? ? :time : Setting.time_format) |
| 77 | 77 |
time = time.to_time if time.is_a?(String) |
| 78 |
zone = User.current.time_zone
|
|
| 78 |
zone = (user || User.current).time_zone
|
|
| 79 | 79 |
local = zone ? time.in_time_zone(zone) : (time.utc? ? time.localtime : time) |
| 80 | 80 |
(include_date ? "#{format_date(local)} " : "") + ::I18n.l(local, options)
|
| 81 | 81 |
end |