Convert Field-based Schedules to UTC

Code

Filename: gpns-convert-schedules-to-utc.php

<?php
/**
 * Gravity Perks // Notification Scheduler // Convert Field-based Schedules to UTC
 * https://gravitywiz.com/documentation/gravity-forms-notification-scheduler/
 */
add_filter( 'gpns_schedule_timestamp', function( $timestamp, $notification, $entry, $is_recurring, $current_time ) {

	if ( $notification['scheduleType'] === 'field' ) {

		$date = new DateTime();
		$date->setTimestamp( $timestamp );
		$date->setTimezone( wp_timezone() );

		$timestamp += $date->getOffset();

	}

	return $timestamp;
}, 10, 5 );

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.