Hello @pppalumni,
I hope you’re doing well today.
I have replicated that with the dropdown date field, and there’s no option to add zeros, so we’ll be checking this further with the Second Line Support (SLS) team.
Please note, that it may take longer for the SLS techs to check, depending on the current number of complex tasks.
As a workaround for now, you can use the Calendar type instead of Dropdowns, and {date-1} macro. This way the leading zeros should be automatically added.
Best Regards,
Dmytro
Hello @pppalumni ,
Please try the following code as mu-plugin:
<?php
add_filter( 'forminator_prepared_data', 'wpmudev_date_field_macro_fix', 10, 2 );
function wpmudev_date_field_macro_fix( $prepared_data, $module_object ){
if ( $module_object->id != 1609 ) { // Please change the form ID.
return $prepared_data;
}
if ( ! empty( $prepared_data['date-1-month'] ) ) {
$prepared_data['date-1-month'] = sprintf( "%02d", $prepared_data['date-1-month'] );
}
if ( ! empty( $prepared_data['date-1-day'] ) ) {
$prepared_data['date-1-day'] = sprintf( "%02d", $prepared_data['date-1-day'] );
}
return $prepared_data;
}
Please change Form ID 1609 to your form’s ID.
See how to create and use mu-plugins https://premium.wpmudev.org/docs/getting-started/download-wpmu-dev-plugins-themes/#installing-mu-plugins
Make sure to take a backup before making any changes to your site.
kind regards,
Kasia
Hi all, thanks for your replies! Sounds promising.
I’ll look into these possibilities!
Best pppalummni