I was setting up a site today and wanted to change the default date format, so went to the page at: admin/settings/date-time

However since today is the 7th of July, I was presented with a choice between '07/07/2008' and '07/07/2008' (see attached pic). I assume this happens on one day a month. The same issue exists in Drupal 5.7.

Although this is potentially a user-facing dialogue, and therefore it should be kept as friendly as possible, it is destined in most cases (I guess) to be setup by the site administrator once and then left alone. For occasions like today, where the day and month are indistinguishable in numeric form, perhaps we could add plain text to clarify.

The form is generated by the 'system_date_time_settings()' function in system.module. A simple fix might be something like this (beginning at line 797 in D5.7) which appends the date format to the option text string:

  // Date settings: construct choices for user
  foreach ($dateshort as $f) {
    $dateshortchoices[$f] = format_date(time(), 'custom', $f).' ('.$f.')';
  }

It might be more user friendly to add a plaintext alternative to the PHP date strings - e.g: '07/07/2008 (mm/dd/yyyy hh:mm)' instead of '07/07/2008 (d/m/Y - H:i)', but i can't think of an easy way to do that without modifying the existing array.

(Workarounds include: checking an existing site setup, and seeing that it's the 2nd option I want, or waiting 'till tomorrow!)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

matkeane’s picture

OK, just thought I'd bump this as we are currently the 09/09/2008, and anybody setting up a Drupal site today is having the same problem as me!

Pasqualle’s picture

Version: 6.2 » 7.x-dev
Priority: Minor » Normal
matkeane’s picture

Status: Active » Needs review
FileSize
1.83 KB

OK, so while this is undoubtedly a really minor point, on certain days of the year the UI text doesn't allow the user to make a sensible choice of date display format. Attached is a patch which attempts to make things clearer by appending descriptive text, rather than the actual date values, to the select item.

matkeane’s picture

Title: Unable to distinguish date formats when day and month are the same number » Add UI text to make date format choices less ambiguous

Changed title to better reflect the aim of the patch, rather than the problem.

heather’s picture

I made a short video showing how this works. BIG improvement. So simple. +1 from me too.

http://vimeo.com/6557697 (currently processing)

First, what it looks like without the patch in d7, and then what it looks like after the patch.

This video is to help others review this patch without needing to apply it.

-------------------------------------------------------------------------
See & edit list of *hot patches* which need user testing.
http://groups.drupal.org/node/26409

heather’s picture

FileSize
166.59 KB

Adding screenshot.

This patch may be mooted by #11623: Localize date formats

stella’s picture

Subscribing - may merge into #11623: Localize date formats once more usability reviews of this are done.

matkeane’s picture

@heather: Thanks for adding the video and the screenshot - it makes it really easy to see the difference before/after the patch.

@stella: Given the great work you've done on the customizable date formats, I think it makes sense to roll this issue into the other one, assuming you think it's worthwhile.

I still have a couple of doubts about this patch (or the approach I took, anyway):

- Adding the extra text means that the select option no longer gives an actual preview of how the date will look - is it obvious enough to the user that the text within parenthesis is only there for clarification and will not be displayed?

- Although I tried to make the descriptions a bit clearer than the PHP date formats, they're still pretty long and ugly! Would it be preferable to simplify things to say '(day/month/year)' or '(month/day/year)'? That means there's still some ambiguity - for example, 11h. is that 12/24 hour? with/without zero prefix? - but perhaps these are edge cases, for which it's not worth cluttering the interface?

MadOverlord’s picture

Newbie user, just ran into this issue doing a tutorial!

Something else that would make the choices even clearer is to simply restrict the ranges of the various fields in the example date strings to non-ambiguous values, rather than basing them on the current date/time.

ie:

year always 2000
month always in range 1-12
day always in range 13-28

12h always in range 1-11
24h always in range 13-23

This guarantees that any date/time string can be properly decoded. The only marginal one is the hour format, but that would quickly become clear by context.

You could also shift the explanatory format description (ie: MM/DD/YYYY...) to outside the popup, so it doesn't clutter it up, and update it when the selection is changed (perhaps also including the current date/time in the newly selected format)

Best,R

matkeane’s picture

Hi,

I had wondered about that approach - showing a live preview of either the current date, or the format description, outside the popup - but I don't think that would degrade very nicely without javascript, which is why I stuck with the cluttered option for this patch. I'm open to suggestions though, as the current patch isn't an ideal solution, it just makes things a bit clearer than they are.

Status: Needs review » Needs work

The last submitted patch failed testing.

matkeane’s picture

FileSize
1.35 KB

You know, I don't set out to be difficult... I'd hosed my D7 install by messing around, so today I decided to do a clean install. And, once again, find myself prompted with a difficult choice when it comes to the date format: Hmmm, should I pick 11/11/2009, or 11/11/2009 ?

Anyway, I guess that's a sign that I should re-roll this patch...

[Edit] This is pretty much a straight re-roll of the previous patch. In the light of Stella's work on #11623: Localize date formats, this should probably be separated out into a function so that it can also be called for the form on admin/config/regional/date-time/types/add

stella’s picture

Perhaps rather than showing the current date and time, we should just pick a specific date and time? e.g. always the 28th of the current month/year, at 2:30pm?

matkeane’s picture

I think I'd be confused if I went to the date/time configuration page and it wasn't showing the correct date. Or do you mean just for the descriptive text? Something like:

2009-11-11 21:34 (e.g. 2009-11-28 14:30)

...rather than:

2009-11-11 21:34 (e.g. YYYY-MM-DD hh:mm)

That could work. The 'YYYY-MM-DD' text patterns seem to be used a lot on web forms on various sites, so I think it's something that people are used to seeing, but I do accept that it makes the select box feel cluttered.

matkeane’s picture

Status: Needs work » Needs review
FileSize
1.71 KB

Sorry, been busy on other projects for a while. Here's a new patch which uses Stella's suggestion of using the same unambiguous example time (2:30pm on the 28th of the month), rather than 'DD/MM/YYYY etc' for the descriptive text.

This simplifies the code a bit (maybe at the expense of making the user think a bit more!), and I've broken it out into a separate function so that it can also be called for the form at 'admin/config/regional/date-time/types/add'.

Dries’s picture

Status: Needs review » Needs work

Some quick coding style issues:

+++ modules/system/system.admin.inc 2010-01-10 19:20:21.000000000 +0100
@@ -1991,6 +1991,26 @@ function system_date_time_settings() {
+  if(isset($format['format'])){

Spacing issue.

+++ modules/system/system.admin.inc 2010-01-10 19:20:21.000000000 +0100
@@ -1991,6 +1991,26 @@ function system_date_time_settings() {
+    if($format['type'] != 'long') {

Spacing issue.

+++ modules/system/system.admin.inc 2010-01-10 19:20:21.000000000 +0100
@@ -1991,6 +1991,26 @@ function system_date_time_settings() {
+      // Append descriptive text using example time of 2:30pm on 28th of current month

Comments need to end with a point, and needs to wrap at 80 characters.

matkeane’s picture

FileSize
1.69 KB

Hi, sorry, I should have run it through the Coder module to catch the formatting issues. Updated patch attached.

I still have a doubt about the descriptive text though. Anybody have any feelings about which - the fixed example date, or the dd/mm/yyy - format is clearer for end-users?

matkeane’s picture

Status: Needs work » Needs review

... and setting back to 'needs review' to get the bot to test the patch.

Status: Needs review » Needs work

The last submitted patch, 279570-4.patch, failed testing.

Status: Needs work » Needs review

Re-test of 279570-4.patch from comment #17 was requested by matkeane.

aeronox’s picture

matkeane: The example date adds too many numbers, making it harder to understand. When I see the alphabetic letters, I immediately understand the format.

matkeane’s picture

@aeronox: Thanks for the feedback. I think I prefer the letter codes as well, but was hoping to get a few more opinions. When I get a moment, I'll re-roll an earlier version of the patch which uses that style of display.

matkeane’s picture

FileSize
2.02 KB

I just re-installed my D7 test site, and using the 28th of the month for the example date is really confusing when it is actually the 28th, because it just makes it look like the time is incorrect. Using the 28th also makes it impossible to distinguish between D and DD for the day display so, all things considered, I think it's back to the 'DD/MM/YYYY' style of descriptive text. New patch attached.

cosmicdreams’s picture

#23: 279570-5.patch queued for re-testing.

matkeane’s picture

FileSize
1.68 KB

Just re-rolled that patch against the latest version of Head, as it's been a while.

matkeane’s picture

FileSize
2.02 KB

Oops, please ignore #25. New patch attached with the line I missed in the previous one, and created at Drupal root.

matkeane’s picture

FileSize
17.66 KB
2.24 KB

Rerolled to chase head as we're 05/05 today. Patch and demo image attached.

ff1’s picture

Status: Needs review » Needs work

I've had exactly this problem before, so I think this is a great improvement.

A couple of comments though:

  • You have mixed the actual day (Wed) and month (May) in with the date notation, which makes the examples a bit confusing.
  • Also, because the month in your screenshot above was May, you're not able to tell if the month will be truncated to 3 characters.

For these reasons, I think you need to display the notation for the day and month strings. Looking around the web, there does not appear to be a standard notation for these (which I assume is why you opted to display the actual data!), so we could go a couple of ways:

  • Use full PHP notation.
  • Use MMMM for the full month name and DDD for the truncated day name (which makes sense to me because I'm a heavy ms excel user, but may be alien to others).
  • Use MONTH for the full month name and DY for the truncated day name (used by Oracle, but DY could get confusing because those letters are already used).

Having looked at the options, I think the best way forward is to use full PHP notation. It would be a big improvement over the current situation and it is unambiguous, even if some users need to look it up. We could even add a link to the PHP docs page.

matkeane’s picture

Status: Needs work » Needs review

Thanks for the feedback. I kind of agree that displaying the month name as text in among the DD/MM/YYYY lettercodes looks a little strange but, as you say, it's not easy to find replacements that won't cause even more confusion.

The very first patch I submitted showed the PHP notation being used, but this is user facing interface text we're talking about here, and so I really think we need to make the display friendlier and easier to read, otherwise we might as well just point them to the source code. If users have added custom date formats, then they probably understand the PHP notation, but otherwise something more human-readable seems preferable.

I'm open to replacing the month names with something else, but is there a standard for this? Anything with DDD or DY might cause confusion with the DD/MM/YY replacements and using 'Month' might work, but the shortened month name would be 'Mon.' which looks like a shortened version of 'monday', and that's before we think about i18n!

I originally submitted this patch because of the ambiguous numeric day/month display, and I think there is merit in keeping things simple, but if we can reach some kind of consensus about how to replace the day/month text, I'll happily update the patch.

ff1’s picture

@matkeane: I take what you say and I think you are absolutely right. So I think the only solution left is to choose a date in the past and always present that same date. Here is an (arbitrary) example:

Long : Friday, October 5, 2000 - 2:27pm
Medium : Fri, 05/10/2000 - 2:27pm
Short : 05/10/2000 - 2:27pm

All formats are completely unambiguous and since the date is in the past, users should not get confused. Users get to see a date in a format they recognise with no confusing ddmmyy notation and the lists appear much less cluttered.

Cue the discussions about which arbitrary date to select... (when was D1 released?)

Also, I suspect that this is just 'polish' (according to Webchick's recent comments), so this should now be pushed back to D8.

matkeane’s picture

Perhaps we should use Dries' birthday as the date?! I still don't really agree that dd/mm/yy is more confusing than an arbitrary date - as I see this format used almost every time a web site asks for my date of birth, or travel date, or whatever - but I'll go with what people think works best.

As for pushing this back to D8. I'd be disappointed if that meant that a simple UI bug is going to have to wait another 2 years or so to get fixed. This issue is already over 2 years old - originally submitted against D6 - and, while I'm the first to admit that the patch isn't perfect (display of month names/numbers is definitely inconsistent), if a perfect solution to all possible edge cases is what's required then it'll never get in, and we might as well set this as won't fix and forget about it. Meanwhile, maybe I should wait until sunday - 10/10/10 - and reroll the patch?

ff1’s picture

@matkeane: I completely agree that dd/mm/yy is very understandable, even for computer novices. The confusion only occurs when that is combined with the rest of the date/time format.

Let's see if we can get some other comments...

rschwab’s picture

FileSize
1.03 KB

+1 for the idea in #30 to use an unambiguous date rather than add DD/MM/YY to the list, because it solves the issue more elegantly. The list in the preview in #27 seems cluttered to me.

Any date with the day greater than 12 will work, but I vote for 12/31/1969 because its the date before unix timestamp starts making for a quick fix. Patch attached.

rschwab’s picture

Version: 7.x-dev » 8.x-dev
rschwab’s picture

#33: 279570.patch queued for re-testing.

rschwab’s picture

rschwab’s picture

#33: 279570.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 279570.patch, failed testing.

rschwab’s picture

rschwab’s picture

Title: Add UI text to make date format choices less ambiguous » Make date format choices less ambiguous
Status: Needs work » Needs review
FileSize
4.47 KB

Updated #33 for D8.

rschwab’s picture

There was a suggestion in #1436112: Date Format Choice Ambiguous #10 to use Jan 15, 2001 (the release date of drupal 1). Here's a patch that uses that date.

nod_’s picture

#41: 279570-date-format-alt.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 279570-date-format-alt.patch, failed testing.

matkeane’s picture

Just a thought, but if Jan 15, 2001 is used as the reference date and somebody chooses the 2 digit format for the date - 01/15/01 or 15/01/01 - then we're back to square one as far as ambiguity is concerned. So, if a reference date is the preferred route, then 12/31/1969 might be a better option.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Version: 9.5.x-dev » 11.x-dev
Issue summary: View changes
Status: Needs work » Closed (outdated)
FileSize
9.95 KB

Tested this on Drupal 11.x today, standard install. The user now defines the format instead of selecting from a list.

Cheers