Project

General

Profile

Actions

Defect #2831

closed

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

Added by Jack Christensen about 15 years ago. Updated about 15 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
2009-02-24
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

Ruby 1.8.7
Rails 2.2.2
Redmine r2521

Actions #1

Updated by Alexey Lustin about 15 years ago

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 format

lustin@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

Actions #2

Updated by Alexey Lustin about 15 years ago

but for backward comparability the correct format would be like this

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

I think

Actions #3

Updated by Jean-Philippe Lang about 15 years ago

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

Fixed in r2523.

Actions

Also available in: Atom PDF