GravityForm Form Restrictions - Schedule [RESOLVED]

I figured it out with additional code. Works like a charm.

add_filter( 'gform_get_form_filter_4', 'custom_schedule', 10, 2 );
function custom_schedule( $form_string, $form ) {
    $start = '07:00:00';
    $end = '19:00:00';
    $now = date("H:i:s");


    if($start < $end) {

	    // if current time is past start time or before end time

	    if($now <= $start || $now > $end){
		    $form_string = '<p>We are closed today, please return tomorrow to make your 
booking.</p>';
	    }
    }

    // else time frame is within same day check if we are between start and end

    else if ($now <= $start && $now >= $end) {
		    $form_string = '<p>We are closed today, please return tomorrow to make your 
booking.</p>';
    }

   return $form_string;
}
1 Like