You are here

public function BillingPeriodItem::toBillingPeriod in Commerce Recurring Framework 8

Gets the billing period value object for the current field item.

Return value

\Drupal\commerce_recurring\BillingPeriod The billing period object.

File

src/Plugin/Field/FieldType/BillingPeriodItem.php, line 103

Class

BillingPeriodItem
Plugin implementation of the 'commerce_billing_period' field type.

Namespace

Drupal\commerce_recurring\Plugin\Field\FieldType

Code

public function toBillingPeriod() {

  // @todo Set the timezones on both DrupalDateTime objects.
  return new BillingPeriod($this
    ->get('starts')
    ->getDateTime(), $this
    ->get('ends')
    ->getDateTime());
}