Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Setting #default_value on a form element of type 'date' does nothing. Looking at the html source, it seems like the default value is set on the element, but misc/date.js ignores it.
Comments
Comment #2
swentel CreditAttribution: swentel as a volunteer commentedHmm, this works for me:
Maybe because default value needs to be Y-m-d ? Don't know ?
Comment #3
bojanz CreditAttribution: bojanz at Centarro commentedThe docs claim that #default_value is supposed to be an array:
So either we fix the docs, or we fix the form element to process an array-based #default_value.
Comment #4
mpdonadio#1835016: Polyfill date input type is related, as that is where the misc/date.js got added for the polyfill.
Comment #7
pontus_nilssonComment #12
idebr CreditAttribution: idebr at ezCompany commentedThe documentation for the Date form element #default_value was fixed in #2944552: Documentation for #default_value in Date form element is incorrect
Comment #13
marcvangendThere still is a problem. It's not just documentation. I opened a new issue, #3079674: Date element #default_value has no effect.