'Display today's date with month by name instead of month number in Contact Form 7

Our Contact Form 7 form displays today's date on form load with this code:

[date today-date "Today"]

This gives us Today's date of 04/16/2022.

We would like to format the date to display date by month name.

For instance, April 16, 2022

Any ideas if this is possible?



Solution 1:[1]

Short answer: no

Long answer: the format of the <input type="data" value="2022-04-16"/> field is set by the browser and not CF7, furthermore it cannot be custom formatted. There is a whole question/answers thread dedicated to this issue on stackoverflow.

The simplest way to solve this is to use a text input field instead and convert it to a date field using the the jQuery datapicker which has the advantage of being loaded from WP core.

  <script>
  $( function() {
    $( "#datepicker" ).datepicker("option", "dateFormat", "d M yy" );
  } );
  </script>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Aurovrata