Problem/Motivation

When creating a datetime_range field, the “Date type” setting offers three options:

  • Date and time
  • Date only
  • All day

The difference between Date only and All day is hard to understand.
There is currently no UI description explaining how these options behave differently.

Steps to reproduce

  • Add a field Date and Time
  • Select the Choose a field type : Date range
  • View the current description, without an explanation of the types.

Proposed resolution

For the "Date range" field, you need to add a description that lists and explains the three possible types.

Remaining tasks

Usability review to confirm the new text.

User interface changes

In the User interface, Here is the default display:
Default description

In the User interface, Here is the date range display with the description list:
New description

Issue fork drupal-3023777

Command icon 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:

Comments

joachim created an issue. See original summary.

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

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.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.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). 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.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now 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: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

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

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.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.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.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.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now 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.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now 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.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

smustgrave’s picture

This came up as the daily BSI target

Since I don't use the date range field often guess I've never noticed this but indeed it's not clear. Searching the code

// All day fields start at midnight on the starting date, but are
          // stored like datetime fields, so we need to adjust the time.
          // This function is called twice, so to prevent a double conversion
          // we need to explicitly set the timezone.

I would of never known that.

Wonder if a simple solution would be just to add a simple description for the 3 options?

smustgrave’s picture

Issue tags: +Novice

Seems like a good task for a new user.

pcharrat made their first commit to this issue’s fork.

pcharrat’s picture

Assigned: Unassigned » pcharrat
Status: Active » Needs review
smustgrave’s picture

Status: Needs review » Needs work

Thanks but part of the ticket was also updating the issue summary please. With UI changes screenshots should be included too please

If you are another contributor eager to jump in, please allow the previous poster(s) at least 48 hours to respond to feedback first, so they have the opportunity to finish what they started!

pcharrat’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new20.35 KB
new16.12 KB
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Think this is an improvement for sure

quietone’s picture

Assigned: pcharrat » Unassigned
Issue summary: View changes
Issue tags: +Usability, +Needs usability review

This is changing text on the UI so it should pass the Usability Core Gate. Following that, this should be tagged 'Usability', so adding tag.

While this is an improvement, I think we should get the usability folks to confirm the new text, so tagging for a review. I will comment in the #ux channel about this. There are already screenshots here, so this should be ready for them to review.

And un-assigning per Assigning ownership of a Drupal core issue.

joachim’s picture

I'm still scratching my head over why you'd actually need these two types, as #12 explains WHAT is stored but not WHY.

My best guess is that it's to do with duration calculations, which won't work as you might want them with the 'date only' option?

What happens to the end date with the 'all day' option?

It would be useful to experiment with both types and see what is stored and how it behaves.

Also, if the original designers on this could be identified, their input on this would be easier than picking at it.

joachim’s picture

Ah yes, the end value is set to 1 second to midnight:

> $end_date->setTimeZone($user_timezone)->setTime(23, 59, 59);

So with 'all day' you get datetimes stored with times, with the times automatically set to 00:00 and 23:59.

This is better than storing a date only in cases where you need work with the date interval, e.g.:

- calculating how long the period is
- making DB queries to check whether something is in the interval
- avoiding overlaps between different items

benjifisher’s picture

Status: Reviewed & tested by the community » Needs work

Usability review

We discussed this issue at #3587931: Drupal Usability Meeting 2026-05-08. That issue has a link to a recording of the meeting. I am giving issue credit here to the attendees at the usability meeting: @benjifisher, @pallavi singh3013, and @rkoller.

We agree that the proposed change is an improvement on the current text, but we think it is also important to mention timezones. We feel that this is more important than the points raised in Comments #21 and #22.

For example, if I add two datetime-range fields, one with each option, then create a node setting both of them to the range May 8 to May 9, then this is what I see in the database:

MariaDB [db]> SELECT * FROM node__field_all_day_range\G
*************************** 1. row ***************************
                       bundle: page
                      deleted: 0
                    entity_id: 20
                  revision_id: 78
                     langcode: en
                        delta: 0
    field_all_day_range_value: 2026-05-08T04:00:00
field_all_day_range_end_value: 2026-05-10T03:59:59
1 row in set (0.000 sec)

MariaDB [db]> SELECT * FROM node__field_date_range\G
*************************** 1. row ***************************
                    bundle: page
                   deleted: 0
                 entity_id: 20
               revision_id: 78
                  langcode: en
                     delta: 0
    field_date_range_value: 2026-05-08
field_date_range_end_value: 2026-05-09
1 row in set (0.000 sec)

The all-day range goes from 12 AM on May 8 to 11:59:59 PM on May 9 in my timezone (America/New York, currently UTC-4 thanks to DST). That gets saved in the database as 2026-05-08T04:00:00 to 2026-05-10T03:59:59. If @rkoller (UTC+2) views my event, then it will appear as 6 AM on May 8 to 5:59:59 AM on May 10.

We do not have a recommendation for the exact wording, but we suggest adding examples based on the current date and time. For example, it might look something like this (assuming the current time is 15:44 in UTC-4):

  • Date and time: stored as UTC timestamps (Example: 2026-05-09T19:44:00 to 2026-05-09T20:44:00)
  • Date only: stored as dates (Example: 2026-05-09 to 2026-05-10)
  • All day: from midnight in the current user's timezone to one second before midnight (Example: 2026-05-09T04:00:00 to 2026-05-11T03:59:59)

That ends up being a lot of text. Maybe it would be better to show only one line (without the initial label) depending on the currently selected option.

If you want more feedback from the usability team, a good way to reach out is in the #ux channel in Slack.

rkoller’s picture

StatusFileSize
new688.12 KB
new374.61 KB

Thanks for the write up @benjifisher! One brief addition about the micro copy , in the current state the micro copy is also sort of redundant. You first have the option label in the select and then the same label again in the description (which is currently necessary to distinguish the three lines) and then the first two descriptions are more or less repeating the same for a third time; for date and time that the date and time is stored and for date only that only the date without the time is getting stored.

There is one other detail to note that i forgot to test during the meeting. If you are interacting with the select with a screenreader active (voiceover in my case), there are two additional noteworthy details and one question that comes up (check aural_interface.mp4):

  • The helptext ("These settings apply to the Rang field everywhere...") is getting announced when the select element gets into focus, but the paragraph element wrapping that help text isnt programmatically linked to the select element. While the description aka the unordered list that is programmatically linked via aria-describedby is not getting announced - probably because entire unordered lists cant be linked at once
  • If you then navigate ahead with the voiceover cursor / stepper, the bullet points are getting announced as well which is sort of noise.
  • And the one question i ask myself; we came up with the suggestion in #23 to only show one single description for the option that is currently selected. It would have to be tested in different screenreaders if the dynamically changing description is reannounced on every change of the option.

And finally I've noticed one odd behavior in focus management with voiceover active (which is out of the scope for this issue). As illustrated in change_field_type.mp4, the select element gets into focus, you then change the default option to one other option (but with the select still in focus), when you then change the option for a second time the focus on the select is getting lost and moved to the Change field type button - without voiceover active the focus remains on the select element (*the problem in the striked section i am unable to reproduce anymore - initially ran into it in safari, then tried in firefox and edge where i was unable to reproduce, and when i revisited in safari i was unable to reproduce either - but before it was consistently changing the element in focus).

pcharrat’s picture

StatusFileSize
new6.47 KB
new6.6 KB
new7.67 KB

Hello,
I've updated my code to reflect your feedback. You'll find the new descriptions in the images below. I've modified the functionality so that the specific description appears only for the selected type, and I've revised the wording to include examples.
However, there is still a question regarding the examples. For now, I have stuck with static examples. I wonder if it might be better to use dynamic examples, even though that would require more resources each time the form is generated.

pcharrat’s picture

Status: Needs work » Needs review