Project

General

Profile

Actions

Defect #2831

closed

Activity log shows the word "time" instead of the time the activity took place

Defect #2831: Activity log shows the word "time" instead of the time the activity took place

Added by Jack Christensen almost 18 years ago. Updated almost 18 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Resolution:
Fixed
Affected version:

Description

Ruby 1.8.7
Rails 2.2.2
Redmine r2521

Updated by Alexey Lustin almost 18 years ago Actions #1

for me - it happened from r2514

i have simple research this and found what problem is in

RAILS_ROOT/lib/redmine/i18n.rb

    def format_time(time, include_date = true)
      return nil unless time
      time = time.to_time if time.is_a?(String)
      zone = User.current.time_zone
      local = zone ? time.in_time_zone(zone) : (time.utc? ? time.localtime : time)
      Setting.time_format.blank? ? ::I18n.l(local, :format => (include_date ? :default : :time)) : 
                                   ((include_date ? "#{format_date(time)} " : "") + "#{local.strftime(Setting.time_format)}")
    end

on my desktop I have Russian locale and in our ru.yml file where is three time formats default: "%a, %d %b %Y, %H:%M:%S %z" short: "%d %b, %H:%M" long: "%d %B %Y, %H:%M" and don't have format named "time" :format => (include_date ? :default : :time) what why ::I18n.l() method return a string with value "time" the simply stupid fix this problem is a patch RAILS_ROOT/lib/redmine/i18n.rb I have decided what I use the short formatlustin@device:~/redmine/lib/redmine$ svn diff Index: i18n.rb =================================================================== --- i18n.rb (revision 2521) +++ i18n.rb (working copy) @@ -45,7 +45,7 @@ time = time.to_time if time.is_a?(String) zone = User.current.time_zone local = zone ? time.in_time_zone(zone) : (time.utc? ? time.localtime : time) - Setting.time_format.blank? ? ::I18n.l(local, :format => (include_date ? :default : :time)) : + Setting.time_format.blank? ? ::I18n.l(local, :format => (include_date ? :default : :short)) : ((include_date ? "#{format_date(time)} " : "") + "#{local.strftime(Setting.time_format)}") end

Updated by Alexey Lustin almost 18 years ago Actions #2

but for backward comparability the correct format would be like this

:format => (include_date ? :default : "%H:%M")
I think

Updated by Jean-Philippe Lang almost 18 years ago Actions #3

  • Status changed from New to Closed
  • Resolution set to Fixed

Fixed in r2523.

Actions

Also available in: PDF Atom