From: Tero Tilus <tero@tilus.net>
To: sup-talk <sup-talk@rubyforge.org>
Subject: Re: [sup-talk] 12h/24h Datetime format in sup index
Date: Wed, 10 Mar 2010 19:44:49 +0200 [thread overview]
Message-ID: <1268239924-sup-190@tilus.net> (raw)
In-Reply-To: <123554aa1003100745v59a49fd4uda1a800266290d18@mail.gmail.com>
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
prev parent reply other threads:[~2010-03-10 17:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-10 15:45 Dominik Epple
2010-03-10 17:44 ` Tero Tilus [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1268239924-sup-190@tilus.net \
--to=tero@tilus.net \
--cc=sup-talk@rubyforge.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox