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:
- Navigate to
/admin/structure/types/manage/page/form-display. - Select "Single Date Time Picker" as the widget for the
field_datefield. - Edit the widget settings and use the provided example
+1970/01/02as the value for the limit to set the minimum (or maximum) allowed date. - Save the settings.
- Create a new page, i.e.,
/node/add/page. - Notice that the current date can still be selected using the "DateTimePicker-plugin" popup.
- Edit the widget settings again, but now use
+02.01.1970as the value to limit the minimum (or maximum) allowed date. - Save the settings.
- Create a new page, i.e.,
/node/add/page. - 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
Implement a solution and create a merge request.- 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.
Issue fork single_datetime-3473377
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
Comment #3
watergate commentedI've opened a merge request with the proposed changes. Although a simple change, hopefully, it can save people some time figuring out why the provided original examples are not working as expected.