spivurno
3/18/2016 - 8:56 PM

GP Limit Dates // Gravity Perks // Make Min/Max Dates Recur Yearly

GP Limit Dates // Gravity Perks // Make Min/Max Dates Recur Yearly

<?php
/**
 * GP Limit Dates // Gravity Perks // Make Min/Max Dates Recur Yearly
 */
// update "877" to your form ID & "10" to your Date field ID
add_filter( 'gpld_limit_dates_options_877_10', 'gpld_recur_yearly', 10, 3 );
function gpld_recur_yearly( $options, $form, $field ) {
	foreach( array( 'minDate', 'maxDate' ) as $prop ) {
		list( $month, $day, ) = explode( '/', $options[ $prop ] );
		$year = date( 'Y' );
		$options[ $prop ] = sprintf( '%s/%s/%s', $month, $day, $year );
	}
	return $options;
}