Add UI text to make date format choices less ambiguous
| Project: | Drupal |
| Version: | 7.x-dev |
| Component: | user interface text |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
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!)
| Attachment | Size | Status | Test result | Operations |
|---|---|---|---|---|
| date-format-choice.png | 6.28 KB | Ignored | None | None |

#1
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!
#2
#3
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.
#4
Changed title to better reflect the aim of the patch, rather than the problem.
#5
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
#6
Adding screenshot.
This patch may be mooted by #11623: Localize date formats
#7
Subscribing - may merge into #11623: Localize date formats once more usability reviews of this are done.
#8
@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?
#9
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
#10
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.
#11
The last submitted patch failed testing.
#12
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
#13
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?
#14
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.