This project is archived and is in readonly mode.

#5919 ✓resolved
s-andringa

Helper for HTML5 time tag

Reported by s-andringa | November 4th, 2010 @ 06:32 PM

Since other html 5 related helpers are being added as well I thought it'd be nice to also have a convenient helper method for generating a time tag, that automatically deals with setting the datetime attiribute and optionally the contents.

The patch below makes this possible:

time_tag Date.today  # =>
  <time datetime="2010-11-04">November 04, 2010</time>
time_tag Time.now  # =>
  <time datetime="2010-11-04T17:55:45+01:00">November 04, 2010 17:55</time>
time_tag Date.yesterday, 'Yesterday'  # =>
  <time datetime="2010-11-03">Yesterday</time>
time_tag Date.today, :pubdate => true  # =>
  <time datetime="2010-11-04" pubdate="pubdate">November 04, 2010</time>

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Referenced by

Pages