]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
utils.rb: fix Utils.timeago for explicit date output
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Tue, 16 Dec 2008 00:25:03 +0000 (01:25 +0100)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Tue, 16 Dec 2008 00:25:03 +0000 (01:25 +0100)
lib/rbot/core/utils/utils.rb

index 864426b09793d7fe5aab85eda9c627986e39b567..5af26b699090cdf872fd1d2b637919e40de243b3 100644 (file)
@@ -244,7 +244,7 @@ module ::Irc
     # :date_format, used with <tt>to_formatted_s<tt>, default to :default
     def Utils.timeago(time, options = {})
       start_date = options.delete(:start_date) || Time.new
-      date_format = options.delete(:date_format) || :default
+      date_format = options.delete(:date_format) || "%x"
       delta_minutes = (start_date.to_i - time.to_i).floor / 60
       if delta_minutes.abs <= (8724*60) # eight weeks? I'm lazy to count days for longer than that
         distance = Utils.distance_of_time_in_words(delta_minutes);
@@ -254,7 +254,7 @@ module ::Irc
           _("%{d} ago") % {:d => distance}
         end
       else
-        return _("on %{date}") % {:date => system_date.to_formatted_s(date_format)}
+        return _("on %{date}") % {:date => time.strftime(date_format)}
       end
     end
   # Translates a number of minutes into verbal distances.