Hi GF Support Team.
I need help implementing an expiration date of a contract based on the date the agreement is signed.
I tweaked this code based on this post but it returned an invalid code.
Our goal is to have the expiration date auto-populated 6 months after the signed date (today’s date) and the output is ex: “21st of June 2022”.
add_filter( 'gform_field_value', 'all_the_dates', 10, 3 );
function all_the_dates( $value, $field, $name, ) {
// "21st of June" is the format we want
$local_timestamp = GFCommon::get_local_timestamp( time() );
$expiration_timestamp = ( 86400 * 182 ) + $local_timestamp;
$today = date_i18n( 'jS \of F', $local_timestamp, true );
$expiration = date_i18n( 'jS \of F', $expiration_timestamp, true );
$values = array(
'todays_date' => $today,
'three_days' => $three,
'182_days' => $expiration,
);
return isset( $values[ $name ] ) ? $values[ $name ] : $value;
}
Any help would be greatly appreciated.
Thank you!
Liza