Problem/Motivation

In the work on #2794481: Allow end date to be optional we saw some problems with DateRange validation UX. At the moment the error "This value should not be null", and the way the field errors are highlighted, is confusing. This ticket can be worked on in isolation of #2794481: Allow end date to be optional but it's probably easier as a follow up.

Steps to reproduce

  1. Standard profile
  2. Install daterange module
  3. Add a daterange field to *page* node, make it *not required*
  4. Go to /node/add and start to create a page
  5. Leave the start date empty. End the end date. (Reverse has the same outcome)
  6. (Making sure to add required fields like title then) submit.

Current: "This value should not be null" error, and both fields are highlighted red.

Expected: "You must add a start date" or "You must add both dates" and only the start date should be highlighted red.

Proposed resolution

At the moment this gets a NotNull constraint and if you don't enter either date you get a more user friendly HTML5 validation. I think the daterange module should have it's own specialised constraint, especially as we make the end date (and later start date) optional.

If #2794481: Allow end date to be optional is finished it should cover optional end dates.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

sime created an issue. See original summary.

sime’s picture

Issue summary: View changes

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.