I am testing Scheduler with the site's default date format set to dd/mm/yyyy
However the date field placeholder text is displayed as mm/dd/yyyy.
The text underneath the date field reads:
"Format: Wed, 09/14/2016 - 11:24 or 14-09-2016 11:24:30. The default time is Wed, 09/14/2016 - 00:00"
This potentially could be quite confusing for users.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | 2799869-11.remove_configurable_date_format.patch | 27.83 KB | jonathan1055 |
| Screen Shot 2016-09-14 at 11.25.01 AM.png | 25.24 KB | Dave Gray |
Comments
Comment #2
Dave Gray commentedA quick follow up on the initial report. The placeholder text also stays as mm/dd/yyyy when a different date format value is set in the Scheduler config screen:
/admin/config/content/scheduler
Cheers
Comment #3
Dave Gray commentedContinuing to explore this one. I'll include findings to help others with the same issue.
The Scheduler widget uses the HTML5 date input type which is now in Drupal 8 core for use for date fields:
https://www.drupal.org/node/1496632
This is supported differently from browsers to browser, see:
http://www.html5tutorial.info/html5-date.php
In Chrome and Opera it seems like the date format that is shown depends on the default date format and language set in the browser and or browsing device.
Firefox just presents the default Y-m-d
Once UK English was set as the default language in both Chrome and OXS then the date format was shown in an appropriate regional format.
An interesting investigation, but I wonder how many international browser users are just using US English as a default without bothering to configure a regional alternative. I imagine not many non technical users would know where to change this.
It would be nice to figure out a way to present date formats in a date input field that doesn't depend on browser or device config.
On further searching it looks like:
https://www.previousnext.com.au/blog/making-drupal-8-datetime-widgets-use-human-formats
Might offer some clues to a way forward.
Comment #4
jonathan1055 commentedHi Dave,
Thanks for bringing this as an issue and for all your investigations. Yes, in Drupal7 we had full control over the date formatting and display, but the new date widgets have taken some of that away (at least in our current implementation).
Yes, I agree. I've also been concerned that we allow admins to set the date format, but do not actually use it any more (not in the way we did in 7.x) because we no longer have the ability to enter plain text. I am not sure if this was a design decision in the early days of converting Scheduler to 8.x or whether it simply fell off as we started using the date widget.
The issues #2490570: Validate that the 'publish on' value matches the expected format and #2490578: Validate that the 'unpublish on' value matches the expected format are in limbo until we decide what to do about text entry. If you have any ideas I'd be very happy to hear them.
Comment #5
Dave Gray commentedHi Johnathan
I'm very used to the amount of fine control over dates in D7 so the D8 implementation caught me on the hop a bit.
A lot of my work is done with organisations with a very low level of technical know how. I think that the date input field is not as usable as it could be.
Many people won't know if they click on the tiny arrow then a datepicker will then pop up. Of course this is Chrome's implementation but the UI could be better.
Ironically I think the Firefox fallback to the jQuery UI's datepicker on field focus may well be easier for some.
Thanks for responding.
Dave
Comment #6
jonathan1055 commentedThanks for you investigations, Dave.
See also #2853263: Date field hints do not match configured date format in all browsers which was started in the Scheduler queue but has just been moved to Core Datetime module.
Do you think there is anything we (in Scheduler) need to do about this? I don't think there is actually any fault in our code, but could it be improved somehow?
Jonathan
Comment #7
jonathan1055 commentedThe core issue #2791693: Remove sample date from date field error message and title attribute covers this generic problem. I think we can close this on the Scheduler queue now.
Comment #8
jonathan1055 commentedActually, we should do something in Scheduler. Currently we allow admins to select a datetime format but this is ignored by the HTML5 date input widget. Either (a) we should make modifications such as https://www.previousnext.com.au/blog/making-drupal-8-datetime-widgets-us..., or (b) remove the admin-defined date format altogether and use ISO8601 format YYYY-MM-DD without choice.
Comment #9
interx commentedI stumbled on exactly the same problem and came to the same conclusion before finding this post.
My site users have a system locale with a different date notation then what's configured as Date format in config. It is misleading to display a format notation in the description if that is not valid.
I think the date formatting feature should be removed entirely. All scheduler needs to know is that an RFC 3339 date is received from the browser. It always works, always returns correct data, and always gives the same UI everywhere.
Solutions that try to fix HTML date fields client-side should be in a separate contrib module. Doesn't seem to be a core feature of the scheduler module though. But that way they can be applied on all date fields on a site. In my experience, these fixes are a can of worms to get working on all devices in all configurations and not worth the hassle :)
Comment #10
jonathan1055 commentedHi interX,
Yes, I have been thinking about this, and was coming to the same conclusion. In 7.x the Scheduler date format was important because we allowed text entry (if the date popup calendar was not installed) but in 8.x this is in core and we do not have any text entry field. Removing the admin-defined format and removing the text hints we add should simplify things.
Jonathan
Comment #11
jonathan1055 commentedOK, here is a first attempt at getting rid of the configurable date format. For the time being I have left it as a config item, and the form displays the value but it cannot be altered. In future this may disappear from the form altogether. Summary of the changes in this patch:
This change is removing some functionality, but as we can no longer control the date widget in HTML5 like we could back in 7.x I think we have to live with the reduced configurability, for the sake of not confusing our users. We could replace this with a setting to choose a date format from the existing site formats, for use in the messages on node save and in the formatted values stored in hook_node_presave. That gives back site builders some control.
All feedback is welcome, as this is quite a major change.
Jonathan
Comment #12
interx commentedThanks for this. The patch works fine form me.
Just some minor notes:
Comment #13
jonathan1055 commentedThanks for the review and test. I will add
t( )to the return string.As for the validation message, yes this is not within our control. It was the same when we had a configurable scheduler format, so it is no worse now. The code in core is http://cgit.drupalcode.org/drupal/tree/core/lib/Drupal/Core/Datetime/Ele...
Some background is in #501428: Date and time field type in core
Comment #15
jonathan1055 commentedI decided to go for this, and get it committed. Need to get it done, so that we can move on to release rc2