Incorrect examples for minimum and maximum date/time widget settings

Created on 10 September 2024, 3 months ago

Problem/Motivation

The examples provided in the description of widget settings to limit the minimum and maximum date/time are incorrect.

In drupal.single_datetime.js: formatDate property is hardcoded to 'd.m.Y' and according to the documentation, the minDate and maxDate should be provided in the same format.

Steps to reproduce

Assuming a standard Drupal installation, having this module installed (of course) and a field to store a date is attached to an entity. For example, a datetime having machine name field_date is attached to the page node type:

  1. Navigate to /admin/structure/types/manage/page/form-display.
  2. Select "Single Date Time Picker" as the widget for the field_date field.
  3. Edit the widget settings and use the provided example +1970/01/02 as the value for the limit to set the minimum (or maximum) allowed date.
  4. Save the settings.
  5. Create a new page, i.e., /node/add/page.
  6. Notice that the current date can still be selected using the "DateTimePicker-plugin" popup.
  7. Edit the widget settings again, but now use +02.01.1970 as the value to limit the minimum (or maximum) allowed date.
  8. Save the settings.
  9. Create a new page, i.e., /node/add/page.
  10. Verify that the value of tomorrow is the first date that can be selected using the "DateTimePicker-plugin" popup (and the current date is not selectable, as what is expected).

Proposed resolution

Change the description of the minimum and maximum date/time widget setting elements to: "Examples: '0' for now, '+02.01.1970' for tomorrow, '12:00' for time, '13:45:34',formatTime:'H:i:s'. More info".

Remaining tasks

  • Review merge request.

User interface changes

The examples provided in the description of widget settings correctly explain how to configure the minimum and maximum date/time limits properly.

API changes

N.a.

Data model changes

N.a.

🐛 Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

🇳🇱Netherlands watergate

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024