Defect #2831

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

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

Status:ClosedStart date:2009-02-24
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-
Resolution:Fixed Affected version:

Description

Ruby 1.8.7
Rails 2.2.2
Redmine r2521

Associated revisions

Revision 2523
Added by Jean-Philippe Lang almost 9 years ago

Adds missing time format in locales (#2831).

History

#1 Updated by Alexey Lustin almost 9 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

#2 Updated by Alexey Lustin almost 9 years ago

but for backward comparability the correct format would be like this

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

I think

#3 Updated by Jean-Philippe Lang almost 9 years ago

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

Fixed in r2523.

Also available in: Atom PDF