Steps to reproduce:

  1. Start with a fresh installation of Drupal (in particular, one in which the site admin has never saved the form at admin/config/regional/date-time to get that stuff in the database).
  2. Create a new date field, then create some content and enter a date.
  3. View the content. You'll notice that by default, the date is displayed using your site's "Medium" date format.
  4. Now go to the Manage Display screen for that content type. Notice how the summary info tells you that the date will display in the "Long" format (rather than "Medium").
  5. Edit the display settings and change to something else (e.g. the "Short" format), and save. Go back to view the content. It's still showing in the "Medium" format.

The attached patch fixes the bug, though with a todo explaining why it's not a perfect fix. However, this fixes the bug for by far the most common situation in which it will occur (with the Long, Short, and Medium date types provided by Drupal core).

I've also included some test changes which will fail without the main part of the patch but pass with it.

CommentFileSizeAuthor
date-format-type-fix.patch5.39 KBDavid_Rothstein

Comments

karens’s picture

OK, I see the issue here. The problem is if people haven't already configured date and time, since we really need them to do that first. Maybe we need to add a system requirements check, or just a warning when the date module is first enabled to trigger them to go set those values.

In the meantime, this is probably as good as we can do.

karens’s picture

OK, I added both an installation message and a system requirements test that the timezone, first day of week, and date formats have been configured. If they are configured, the status report tells you what they are set to with links to where you reset them. I think that will all be helpful. Next I can go ahead with this patch, which hopefully will finish adding a layer of protection for sites that haven't set these things up.

karens’s picture

Status: Needs review » Fixed

Committed. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.