Problem/Motivation
Working on the developpement of a custom module that relies on dates and times element via form API, I found a couple of "strange" things happening when trying to develop forms with dates.
The purpose of this issue is just to group them, and to discuss if some things could be made better.
1- You cannot define #ajax behavior on a 'date' #type form element:
#2781103: Date FAPI element type do not allow AJAX via #ajax API
Special note: there could be tests added to check that for other form elements too as a follow-up
2- Adding attributes (any attributes, such as class and id for instance) on a date #type form element leads to an error message
#2782831: Date FAPI element type do not support #attributes
3- You cannot define #ajax behavior on a 'datetime' #type form element
#2783615: Datetime FAPI element type do not allow AJAX via #ajax API
4- There is no 'time' #type form element so you can't only request for a time in a form
5- Following-up on (4): 'datetime' #type element could actually construct a combinaison of a 'date' and a 'time' element in a much more elegant way.
6 - #2419131: [PP-1] #states attribute does not work on #type datetime
7 - #1838234: Add jQuery Timepicker for the Time element of the datetime field
8 - #1918994: Improve Datetime and Daterange Widget accessibility
9- Datetime element duplicates #prefix and #suffix sections.
#2783617: Datetime FAPI element type duplicates #prefix and #suffix
10- Datetime element does not support #default_value.
#2783623: Support string #default_value for datetime FAPI element
Comments
Comment #2
mpdonadio+1 to all of these.
There is some overlap between Date/Time support in FAPI, and things getting lumped into DateTime. Added a few issues from there that are more FAPI related, but leaving the component alone on them for the time being. Some need work, some have patches that just need to be reviewed.
Comment #3
Dom. CreditAttribution: Dom. as a volunteer and at ACINO commentedAdded a couple more issues:
#2783615: Datetime FAPI element type do not allow AJAX via #ajax API
#2783617: Datetime FAPI element type duplicates #prefix and #suffix
Comment #4
Dom. CreditAttribution: Dom. as a volunteer and at ACINO commentedDamn, yet another !
#2783623: Support string #default_value for datetime FAPI element