[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sup-talk] 12h/24h Datetime format in sup index
Dominik Epple, 2010-03-10 17:45:
> I would prefer to have this as 24h date
> Can one configure this? How?
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
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk