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!)
Comment | File | Size | Author |
---|---|---|---|
#57 | Screenshot 2024-01-24 at 17-57-16 Add date format dev1-web.png | 9.95 KB | quietone |
#41 | 279570-date-format-alt.patch | 4.52 KB | rschwab |
#40 | 279570-date-format.patch | 4.47 KB | rschwab |
#33 | 279570.patch | 1.03 KB | rschwab |
#27 | 279570-8.patch | 2.24 KB | matkeane |
Comments
Comment #1
matkeane CreditAttribution: matkeane commentedOK, 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!
Comment #2
PasqualleComment #3
matkeane CreditAttribution: matkeane commentedOK, 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.
Comment #4
matkeane CreditAttribution: matkeane commentedChanged title to better reflect the aim of the patch, rather than the problem.
Comment #5
heather CreditAttribution: heather commentedI 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
Comment #6
heather CreditAttribution: heather commentedAdding screenshot.
This patch may be mooted by #11623: Localize date formats
Comment #7
stella CreditAttribution: stella commentedSubscribing - may merge into #11623: Localize date formats once more usability reviews of this are done.
Comment #8
matkeane CreditAttribution: matkeane commented@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?
Comment #9
MadOverlord CreditAttribution: MadOverlord commentedNewbie 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
Comment #10
matkeane CreditAttribution: matkeane commentedHi,
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.
Comment #12
matkeane CreditAttribution: matkeane commentedYou 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
Comment #13
stella CreditAttribution: stella commentedPerhaps 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?
Comment #14
matkeane CreditAttribution: matkeane commentedI 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.
Comment #15
matkeane CreditAttribution: matkeane commentedSorry, 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'.
Comment #16
Dries CreditAttribution: Dries commentedSome quick coding style issues:
Spacing issue.
Spacing issue.
Comments need to end with a point, and needs to wrap at 80 characters.
Comment #17
matkeane CreditAttribution: matkeane commentedHi, 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?
Comment #18
matkeane CreditAttribution: matkeane commented... and setting back to 'needs review' to get the bot to test the patch.
Comment #21
aeronox CreditAttribution: aeronox commentedmatkeane: The example date adds too many numbers, making it harder to understand. When I see the alphabetic letters, I immediately understand the format.
Comment #22
matkeane CreditAttribution: matkeane commented@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.
Comment #23
matkeane CreditAttribution: matkeane commentedI 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.
Comment #24
cosmicdreams CreditAttribution: cosmicdreams commented#23: 279570-5.patch queued for re-testing.
Comment #25
matkeane CreditAttribution: matkeane commentedJust re-rolled that patch against the latest version of Head, as it's been a while.
Comment #26
matkeane CreditAttribution: matkeane commentedOops, please ignore #25. New patch attached with the line I missed in the previous one, and created at Drupal root.
Comment #27
matkeane CreditAttribution: matkeane commentedRerolled to chase head as we're 05/05 today. Patch and demo image attached.
Comment #28
ff1 CreditAttribution: ff1 commentedI've had exactly this problem before, so I think this is a great improvement.
A couple of comments though:
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:
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.
Comment #29
matkeane CreditAttribution: matkeane commentedThanks 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.
Comment #30
ff1 CreditAttribution: ff1 commented@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.
Comment #31
matkeane CreditAttribution: matkeane commentedPerhaps 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?
Comment #32
ff1 CreditAttribution: ff1 commented@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...
Comment #33
rschwab CreditAttribution: rschwab commented+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.
Comment #34
rschwab CreditAttribution: rschwab commentedComment #35
rschwab CreditAttribution: rschwab commented#33: 279570.patch queued for re-testing.
Comment #36
rschwab CreditAttribution: rschwab commentedClosed #937534: REQUEST_TIME poor choice as an example date in #overlay=admin/config/regional/date-time as duplicate
Comment #37
rschwab CreditAttribution: rschwab commented#33: 279570.patch queued for re-testing.
Comment #39
rschwab CreditAttribution: rschwab commentedMarked #1436112: Date Format Choice Ambiguous as a duplicate.
Comment #40
rschwab CreditAttribution: rschwab commentedUpdated #33 for D8.
Comment #41
rschwab CreditAttribution: rschwab commentedThere 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.
Comment #42
nod_#41: 279570-date-format-alt.patch queued for re-testing.
Comment #44
matkeane CreditAttribution: matkeane commentedJust 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.
Comment #57
quietone CreditAttribution: quietone at PreviousNext commentedTested this on Drupal 11.x today, standard install. The user now defines the format instead of selecting from a list.
Cheers