Forum: Radiant CMS Re: Date tag oddness

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
0008835496da08071dd6ea2a6fdf66fe?d=identicon&s=25 Gabriel Lamounier (Guest)
on 2007-03-21 18:40
(Received via mailing list)

The <r:date> tag shows the published_at date (or created_at if the
page hasn't been published yet).

There was a past conversation where some of us agreed that it would be
good if the <r:date> tag accepted another parameter besides "format"
to indicate which date to show (published_at, created_at or

I think it's a good idea that this new parameter accept another value
as "now" so it can show the actual date and time. For example, in a
site I'm working on I had to create a tag to do just that, but it wold
be a lot better to have this a standard feature.

Is anyone working on it?

Be Radiant!
A47e0a6beeb9d048ff054fc1c3a97418?d=identicon&s=25 Walter Davis (walterdavis)
on 2007-03-27 16:32
(Received via mailing list)
On Mar 21, 2007, at 1:39 PM, Gabriel Lamounier wrote:

> Is anyone working on it?
> Be Radiant!
> Gabriel

I couldn't figure out how to do exactly this, as my Ruby-fu is very
very young. So I simply defined a new tag called now, as a clone of

   desc %{
     Renders the current date. The format attribute
     uses the same formating codes used by the Ruby @strftime@ function.
     default it's set to @%A, %B %d, %Y@.

     <pre><code><r:now [format="format_string"] /></code></pre>
   tag 'now' do |tag|
     page =
     format = (tag.attr['format'] || '%A, %B %d, %Y')
     if date =

SInce I used both Copy and Paste, I presume this violates DRY all over
the place. I'm still learning, and this works for now, but I'd love to
see how you would create a :now symbol and pass it to r:date.

This topic is locked and can not be replied to.