Setting Date/Time element min/max shows seconds

Created on 30 January 2023, almost 2 years ago
Updated 11 June 2023, over 1 year ago

Problem/Motivation

Setting a min/max to "now" will set the timepicker's minutes and seconds to the current time, even if the current time is not a valid selection due to the value of #date_time_step, such as setting the time to a minute value of 37 (if "now" is HH:37), if a multiple of 5 is required. It also shows the seconds in the timepicker, even if they shouldn't be shown for the same reason. Similarly, the timepicker shows all minutes in it, even if the #date_time_step is 300 (5 minutes), thus allowing users to select invalid values.

Steps to reproduce

Use this webform YAML:

test:
  '#type': datetime
  '#title': Test
  '#required': true
  '#date_min': '-2 years'
  '#date_max': now
  '#multiple__no_items_message': '<p>No items entered. Please add items below.</p>'
  '#date_year_range': ''
  '#date_time_step': '300'

Proposed resolution

#date_time_step should change which values are shown in the timepicker to only show valid values, and setting the min/max should still respect the value of #date_time_step.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Fixed

Version

6.2

Component

Code

Created by

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

Comments & Activities

Production build 0.71.5 2024