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

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

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

date only

all day

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
smustgrave’s picture

Issue summary: View changes
Issue tags: -Needs issue summary update

Applying the change and does appear feedback is addressed @benjifisher could we remove the usability review tag?

rkoller’s picture

Issue summary: View changes
Issue tags: -Needs usability review +Needs accessibility review
StatusFileSize
new867.64 KB
new1.92 MB

Usability review

We discussed this issue for a second time at #3592720: Drupal Usability Meeting 2026-06-19. The link to the recording: https://www.youtube.com/watch?v=8fuVN9kiZ1c&t=11s.The attendees at the usability meeting were: @benjifisher, and @rkoller.

Thanks to @pcharrat for working on the MR and incorporating the feedback in #23! We have taken another look at the current state of MR15387 and there are few more details to note.

In regard to the question in #25, we still think having dynamic examples based on the current date (and time) would make the examples more clear in particular for the Date and time date type.

We've discovered several problems in the context of accessibility, for one with the MR checked out, but also already within the main branch. The problem for core in general, if you are interacting with a select element within a dialog modal by keyboard with VoiceOver enabled, as soon as you are trying to expand the option list of a select element for a second time by pressing the space bar the focus jumps to the Change field type button - that is not in line with WCAG 2.2 SC3.2.1 (jumpy_focus.mp4 - recorded with the main branch checked out) but clearly out of the scope for this issue, it should be solved in a dedicated followup issue.
In addition to that, the dynamic change of descriptions for the selected select element option are communicated in a confusing and misleading manner within the aural interface. In voiceover.mp4 (recorded with MR15387 checked out), first the label of the active option and its corresponding description for the select element are being announced, including the title of the field set (Field storage) and its help text, then the label of the active option and its corresponding description are announced a second time, and finally also the allowed number of value's active option and the chosen value are being announced in one go. If you then change from the date type Date and time to Date only the description for the Date and time date type is announced another time, plus the element is now announced as dimmed aka disabled which is not true. At this point the core bug illustrated in jumpy_focus.mp4 kicks in. But you can see in the following that the correct description was only announced for the default option when the dialog modal was opened for the first time, in the following it looks like always the description of the previous choice is being announced. The question is, is the cause for this misbehavior rooted in Drupal core or VoiceOver - as a first required step it would be important to test the MR in Jaws, NVDA, Orca, and or any other screenreader solution - I am adding the Needs accessibility review tag for that reason, and also to get few more pair of eyes onto that matter.

In regard to the micro copy, aside using dynamic example based on the current date (and time) we would recommend the following changes to the descriptions:

For Date and time
Stored as UTC date and time values (Example: 2026-05-09T19:44:00 to 2026-05-09T20:44:00).

For Date only
Stored as dates only, with no time values (Example: 2026-05-09 to 2026-05-10).

For All day
Stored as a full-day range in UTC, from midnight to 11:59:59 PM in the current user's timezone (Example: 2026-05-09T04:00:00 to 2026-05-11T03:59:59).

We are basically denote that timezones are being minded by Drupal and in what timezone date and time are being stored - a piece of information a user usually has no touchpoint with in the admin UI necessarily. That detail is relevant to Date and time and All day date types, while we've dropped the mention of timezones for the Date only date type.
In regard to consistency, we've also realized that the date type descriptions on the datetime field type are completely generic and not helpful at all. At the moment you have the same description Choose the type of date to create. for every date type option on the datetime field. Our recommendation would be to either extend the scope for this issue or open up a followup that should go into core, alongside with this issue ideally. It should be avoided having two different sets of descriptions, cuz datetime fields have the same two date types, Date and time and Date only, as the Datetime range. The only difference, the descriptions for datetime require singular forms, while the descriptions for Datetime range require plural forms. So in consequence our recommendation for the extended scope/followup for the date types on the datetime field type are:

For Date and time
Stored as UTC date and time values (Example: 2026-05-09T19:44:00).

For Date only
Stored as date only, with no time value (Example: 2026-05-09).

I've removed the "Needs usability review" tag and updated the User interface section by adding headings for before and after for an improved readability and comprehension.

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

pcharrat’s picture

I've updated the static wording to match the feedback from #28.
At this stage, I have two questions before going further:

  1. Should the scope of this issue be expanded? The latest feedback also mentions the inconsistency with the datetime field type descriptions. Do you want this issue to evolve into a broader update of all date type descriptions, or should it remain limited to datetime_range and leave the rest for a follow-up issue?
  2. Is a dynamic description actually desirable here? It would be possible to generate examples dynamically so that they better reflect the current date/time and timezone context, but that would also mean introducing additional logic using DrupalDateTime, DateTimeZone, and the current user timezone. I am not sure whether that is a good idea here.