You are here

function interval_rules_apply_interval in Interval Field 8

Same name and namespace in other branches
  1. 7 interval.rules.inc \interval_rules_apply_interval()

Rules action callback: Apply an interval to a date.

1 string reference to 'interval_rules_apply_interval'
interval_rules_action_info in ./interval.rules.inc
Implements hook_rules_action_info().

File

./interval.rules.inc, line 51
Provides rules integration for interval module. @copyright Copyright(c) 2011 Lee Rowlands @license GPL v2+ http://www.fsf.org/licensing/licenses/gpl.html @author Lee Rowlands contact at rowlandsgroup dot com

Code

function interval_rules_apply_interval($interval, $period, $datestamp) {
  $date = new DateObject("@{$datestamp}");
  $item = [
    'interval' => $interval,
    'period' => $period,
  ];
  interval_apply_interval($date, $item);
  return [
    'date' => $date
      ->format('U'),
  ];
}