Thank you for waiting, while I performed some further testing on my website.
Unfortunately, the password for your website's admin access didn't work, but I managed to connect a date type generic field in a post edit form, to post date, using these steps:
1. In the edit form, I used the "wpv-post-date" shortcode to set the default value of a generic date type field, equal to the current post's date:
( ref: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-date )
<div class="form-group">
<label>Post Date</label>
[cred_generic_field type='date' field='post-date']
{
"required":0,
"validate_format":1,
"default":[wpv-post-date format="U"]
}
[/cred_generic_field]
</div>
As a result, when the edit form loads, it shows the current post's published date, automatically filled in that date type generic field.
2. Next, I added a custom function attached to the "cred_save_data" hook, so that the date selected in that generic field can be updated, as the current post's published date, when the form is submitted:
( ref: https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data )
add_action('cred_save_data', 'set_post_date_to', 100, 3);
function set_post_date_to($post_id, $form_data) {
if( $form_data['id'] == 12345 ) {
$newDate = $_POST['post-date']['datetime'] . ' 00:00:00';
$my_post = array(
'ID' => $post_id,
'post_date' => $newDate,
'post_date_gmt' => $newDate,
);
// Update the post into the database
wp_update_post( $my_post );
}
}
Note: you'll replace "12345" with your actual form's ID.