Change Max Delta

Control the max delta that’s allowable between the frontend calculation result and the backend calculation result before triggering a warning email and/or note.

Code

Filename: gpdtc-change-max-delta.php

<?php
/**
 * Gravity Perks // Date Time Calculator // Change Max Delta
 * https://gravitywiz.com/documentation/gravity-forms-date-time-calculator/
 *
 * Control the max delta that’s allowable between the frontend calculation result and the backend calculation
 * result before triggering a warning email and/or note.
 */
add_filter( 'gpdtc_warning_max_delta', function( $delta, $result, $formula, $field, $form, $entry ) {
	// Update "123" to the form ID and "4" to the ID of the Number field with the Date Time calculations.
	if ( $field->formId !== 123 || $field->id != 4 ) {
		return $delta;
	}
	// Update "0.0002" to your preferred max delta value.
	return 0.0002;
}, 10, 6 );

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.