class Time Redwood::HookManager.register "time-to-nice-string", < self, :from => from) || default_to_nice_s(from) end def default_to_nice_s from=Time.now if year != from.year strftime "%b %Y" elsif month != from.month strftime "%b %e" else if is_the_same_day? from format = $config[:time_mode] == "24h" ? "%k:%M" : "%l:%M%p" strftime(format).downcase elsif is_the_day_before? from format = $config[:time_mode] == "24h" ? "%kh" : "%l%p" "Yest." + nearest_hour.strftime(format).downcase else strftime "%b %e" end end end ## This is how a message date is displayed in thread-view-mode def to_message_nice_s from=Time.now format = $config[:time_mode] == "24h" ? "%B %e %Y %k:%M" : "%B %e %Y %l:%M%p" strftime format end end