Contact Form: Custom Date Format
The "Date" field was added to contact forms through issue #269:
[contact-field label='Pick a date' type='date'/]
Currently the date is hard coded to show as yy-mm-dd once it is chosen in the form's calendar, as shown in the following code:
https://github.com/Automattic/jetpack/blob/master/modules/contact-form/js/grunion-frontend.js
Instead, would it be possible to allow a choice in the format of the date shown? For example, Month DD, YYYY.
Requested in 2593714-t
Related: https://api.jqueryui.com/datepicker/#option-dateFormat
This is currently using an HTML date input field, in addition to loading a jQuery datepicker UI on top.
Regarding date input fields, according to Mozilla:
One thing to note is that the displayed date format differs from the actual value — the displayed date format will be chosen based on the set locale of the user's operating system, whereas the date value is always formatted yyyy-mm-dd.
It appears that date input fields require a yyyy-mm-dd format, and this is not configurable (since the browsers do it automatically for you).
#7819 offers a solution to clear up the duplicated datepicker UI by using jQuery only as a fallback for legacy browsers without date input field support. In this case, I think leaving jQuery to follow the same format as the default date input field is the best option - especially over time as these browsers become obsolete and the jQuery backup is no longer needed.
Fixed in #7819