A Drupal Views "Date Trap"

Here's a oddity that caused me a bit of grief this weekend - blogged in the hope that search engine goodness will save someone else some hair pulling.

New date formats configured through the Date module aren't made available through Views immediately.

To reproduce the problem:

  1. Log onto your site as user with administration rights.
  2. Go to Administer|Site Configuration|Date and Time|Formats
  3. Add a new format type
  4. Go to Administer|Site Building|Views
  5. Edit your view of choice
  6. Select any date Field and drop down the list of available Formats

You'll see that your new format isn't listed.

Workaround

  1. Go to Administer|Site Building|Modules
  2. Press Save (no changes are necessary)

Now, you'll find that the new format is available.

It seems that either Date isn't sending the right notification to Views that a new format is available, or Views is caching the list of available formats too aggressively.

Versions:

  • Drupal 6
  • Date, DateAPI: 6.x-2.2
  • Views, Views UI: 6.x-2.5

Comments

Ahhhhh - Thank You

I have been stumped on this one for ages! Thank you for pointing that out! You have no idea how frustrated I was over that silly little point.

Thanks again!

Works like a charm

Hey man, thanks for this trick, I was stuck a little bit (1 hour is not too much). This worked grad. Brgds

Thanks

Cheers!

Thanks for your post

I've tried it, and it works.

Thanks

Sheesh.

I was confused for an entire afternoon because of this. Thanks for the tip.

Clearing the cache also works

Going to Site Configuration->Performance and clearing the cache also makes the new format visible.

This helped!

Thanks for posting this... googling "drupal date views format" brought me to this.

Bug report?

Thanks for posting this -- as with the others, I was going slightly mad trying to figure out what was happening. Did you submit a bug report to Drupal about this that we can vote up? If not I'll happily go and create one.

Already Reported

As I recall (it's been a while), I found this bug had already been logged against Views, but had languished in the queue for a while with no action.

If you have the time to find and vote up this issue, I'm sure that would be worthwhile.