Problem/Motivation
#states do not work with 'datetime' form elements.
Proposed resolution
Update logic in the Datetime element to handle the nested elements.
Remaining tasks
Fix test fails.
User interface changes
None, other than #states working.
API changes
None.
Data model changes
None.
Original Report
While trying to create a custom field widget containing a "datetime" form element, I discovered that the #states attribute does not work on it.
Some states can be achieved with a workaround: put the datetime element in a container, and put the #states on the container. But this is obviously no clean fix, and it doesn't work for all states. (Works for "visible" for example, but not for "required".)
I was not able to figure out why this is not working, but I noticed that there have been a lot of issues regarding the #states attribute in the issue tracker. Most of them for were for specific elements like submit buttons, select elements with multiple values, ...