This module, submitted to be a submodule of the cck_formatters collection, provides a formatter which puts span tags around month, day, and year, all wrapped in div with past, current (in next 12 hours), and future.

It comes out looking like this, in an event referencing DrupalCon Paris:

<div class="past"><span class="month">Sep</span><span class="day">25</span><span class="year">2009</span></div>

Well, that's what it looks like in code, it's supposed to look quite a bit better.

Questions for potential users:
- Should there be configuration options (show time, change order of date elements)?
- Should CSS for theming this be included in the module?

(Background, see more than one way to span a date.)

CommentFileSizeAuthor
cck_formatters-spandate-new-module.patch2.16 KBmlncn
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Danny Englander’s picture

I tried this patch and it works great, however the issue I am still struggling with is when I use this format in views, I still end up with a div inside a span. I have tried various methods to try to remove the span tag but with no luck. In my case it's <span class="field-content"> before the date div that keeps getting me.

The rendered HTML as I see it is:

<span class="field-content">

 <div class="future">
  <span class="month">Apr</span>
  <span class="day">13</span>
  <span class="year">2011</span>
 </div>

</span>

I am thinking I will have to do some views custom .tpl theming or a template.php override to get rid of that field or at least change it to a div.

mlncn’s picture

@highrockmedia - glad it helped! The Semantic CCK module should also be able to clean up the surrounding span for you.

@anyone - Note that the key part of the code could be used in a theme as well as a module.