* [sup-talk] 12h/24h Datetime format in sup index
@ 2010-03-10 15:45 Dominik Epple
2010-03-10 17:44 ` Tero Tilus
0 siblings, 1 reply; 2+ messages in thread
From: Dominik Epple @ 2010-03-10 15:45 UTC (permalink / raw)
To: sup-talk
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
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [sup-talk] 12h/24h Datetime format in sup index
2010-03-10 15:45 [sup-talk] 12h/24h Datetime format in sup index Dominik Epple
@ 2010-03-10 17:44 ` Tero Tilus
0 siblings, 0 replies; 2+ messages in thread
From: Tero Tilus @ 2010-03-10 17:44 UTC (permalink / raw)
To: sup-talk
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-03-10 17:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-10 15:45 [sup-talk] 12h/24h Datetime format in sup index Dominik Epple
2010-03-10 17:44 ` Tero Tilus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox