Subject: [sup-talk] 12h/24h Datetime format in sup index

From: Dominik Epple <[email-masked]>
Date: Wed, 10 Mar 2010 16:45:56 +0100

Hi,

in the sup index, the datetime column looks like this (for me):

   11:05
    6:28
    3:29
   12:30
 Yest. 7
 Yest. 5
 Yest. 3
 Yest. 3
 Yest. 2
 Yest. 2

It took me some time to find out that this is a 12h time format
(without am/pm indicators). I would prefer to have this as 24h date
format, such that the dates above would be written as:

   11:05
    6:28
    3:29
    0:30
 Yest. 19
 Yest. 17
 Yest. 15
 Yest. 15
 Yest. 14
 Yest. 14

Can one configure this? How?

Thanks
Dominik
_______________________________________________
sup-talk mailing list
[email-masked]
http://rubyforge.org/mailman/listinfo/sup-talk

---

From: Tero Tilus <[email-masked]>
Date: Wed, 10 Mar 2010 19:44:49 +0200

Dominik Epple, 2010-03-10 17:45:
> I would prefer to have this as 24h date

You need index-mode-date-widget hook

$ sup --list-hooks
...
index-mode-date-widget
----------------------
File: /home/terotil/.sup/hooks/index-mode-date-widget.rb
Generates the per-thread date widget for each thread.
Variables:
  thread: The message thread to be formatted.
...

Mine looks like this

date = thread.date
from = Time.now
if date.is_the_same_day? from
  # same day
  date.strftime("klo %H:%M")
elsif date.is_the_day_before? from
  # yesterday
  date.nearest_hour.strftime("eilen %H")
else
  if date.year != from.year
    # different year
    date.strftime("%e.%m.%Y")
  elsif date.month != from.month
    # same year
    date.strftime("%e.%m. %H")
  else
    # same month
    date.strftime("%e. %H:%M")
  end
end

Just copy that to your .sup/hooks/index-mode-date-widget.rb and tweak
the formats (strftime calls) to suit your needs.  Available formats
you find from <http://ruby-doc.org/core/classes/Time.html#M000298>.

-- 
Tero Tilus ## 050 3635 235 ## http://tero.tilus.net/
_______________________________________________
sup-talk mailing list
[email-masked]
http://rubyforge.org/mailman/listinfo/sup-talk