
Problem/Motivation
The error message if the start is before the end date is unnecessary technically and should be changed. Also the link text in for the Inline Form Error summary needs editing.
Proposed resolution
Change the interface text from "The [field label] end date cannot be before the start date" to "The end of [field name] cannot be before its start." (After the patch, the field name is in italics and there is ending punctuation.)
Remaining tasks
- Link to related issues. Create them if needed. See #33.
User interface changes
Without the patch, without Inline Form Errors module
Without the patch, with Inline Form Errors module
With the patch, without Inline Form Errors module
With the patch, with Inline Form Errors module
API changes
None
Data model changes
None
Comment | File | Size | Author |
---|---|---|---|
#40 | 2895055-date-range-error-message-19.patch | 975 bytes | yazanmajadba |
#32 | after-with-inline.png | 75.72 KB | benjifisher |
#32 | after-no-inline.png | 44.94 KB | benjifisher |
#32 | before-no-inline.png | 42.28 KB | benjifisher |
#32 | before-with-inline.png | 70.05 KB | benjifisher |
Issue fork drupal-2895055
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 2895055-edit-the-date
changes, plain diff MR !672
Comments
Comment #2
ifrikComment #3
ifrikI'm working on this now.
Comment #4
ifrikI've edited the error message and added some formatting to separate the field label from the rest of the message. However the "value 1" comes from the general widget base, and I make a different issue to change it in general.
Comment #5
ifrikForgot to remove the devel code
Comment #6
ifrikComment #9
mpdonadioThanks. I think I like that error message better. Once you fix the fail, can you post an after screenshot to the IS? It will help with final review.
Most of core uses %title as the placeholder in error messafes, which will add the <em> element. That will also make it easier to translate.
And just as a general note, even though this is a bug, the string change means it can't go against 8.3.x (since this is still an experimental, a committer may decide otherwise).
Comment #10
ifrikThanks for the review. I fixed the test and @.
The error message reads as:

The field title is rendered as "field label (value x)" by the field widget, so to turn that into something that is nicer to read would require a more far reaching change there, so I leave that as it is.
Comment #12
ifrikUploading the patch, even though it will fail:
Locally, the test passes if I use
@title
, but when I replace it by%title
it fails on line 1307 in the DateRangeFieldTest.Comment #14
mpdonadio#12, for the purpose of the test, I would be OK using @title. The main thing we are testing is the actual test and the error message.
See the comment on https://www.drupal.org/node/2863444#comment-12174307. I'm wondering if we need to split out the error messages to handle the case of same date, but end time < start time.
Comment #15
ifrikThanks, I'll change the test accordingly.
I tried to got around talking about date when the error would be caused the end time, by just using "end" and "start" in the error message. So I suppose one error message should be fine.
Comment #16
ifrikThe test now uses @title, but I'm still intrigued why it otherwise fails...
Comment #17
ifrikComment #18
ifrikLearning PHPUnit tests just to change an error message :-)
Test failed because assertText strips the HTML, while assertRaw keeps it.
Comment #19
mpdonadioI'm good with this, but think a UX signoff is best here.
UX reviewer, is current message good or do we need to be more granular about the date/time portions in the error message? The current screenshots show date-only field, but this field can also capture date+time as two separate inputs.
Will try to post before/after screenshots of date+time tonight.
Comment #20
ifrikI've added two other error messages to be fixed as well.
Comment #21
ifrikI would change the wording make sure that users know that the format is invalid, not the date or time itself. And also name it without specifically saying that the date is the problem, because it could also be the format of the time that invalid.
What do you think of a text such as this - before I fix all the tests?
The format used for <em>End date</em> is invalid. Please change it to <em>2017-07-22 18:47:11</em>.
Comment #22
ifrikThe error message about invalide date format, is not from the datetime_range module but from Drupal's core library, so I remove it again from the issue summary, to avoid any issue creep.
Comment #23
ifrikComment #29
xjmComment #32
benjifisherI am updating the issue description. The original had only one screenshot, which is now out of date. The description did not mention that the screenshot was made with the
inline_form_errors
module enabled. I am attaching before and after screenshots with and without that module.Comment #33
benjifisherUsability review
We discussed this issue at #3176758: Drupal Usability Meeting 2020-10-20.
We agree that the text change is a step in the right direction. While testing the patch, we noticed a few more things that should be improved:
We should not try to Fix Everything as part of this issue, but before this issue is fixed we should either create new issues or find existing ones. Either way, add them as related issues here. (If there is an easy way to do (2), then that could be added to this issue.) As far as testing and code review are concerned, this issue is RTBC, but I am setting the status to NW for the related issues.
Comment #34
aaronmchaleI agree with @benjifisher in #33, this is a small patch which improves existing messaging, once follow-ups are created/found I'm happy with this being RTBC.
Thanks,
-Aaron
Comment #39
yazanmajadba CreditAttribution: yazanmajadba at Vardot commentedIn sometimes the error messages are appear duplicate
This patch solve this issue, show error message only in end date field
Comment #40
yazanmajadba CreditAttribution: yazanmajadba at Vardot commentedIn sometimes the error messages are appear duplicate
This patch solve this issue, show error message only in end date field