Commit 0d2c4cf3 authored by Brian Suttis's avatar Brian Suttis Committed by Jonathan Sacksick
Browse files

Issue #3209414 by bsuttis, igorbarato, DamienMcKenna: Promotion start date...

Issue #3209414 by bsuttis, igorbarato, DamienMcKenna: Promotion start date default value doesn't respect time zone.
parent 96928140
Loading
Loading
Loading
Loading
+1 −1
Changes for modules/promotion/src/Entity/Promotion.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -928,7 +928,7 @@ class Promotion extends CommerceContentEntityBase implements PromotionInterface
   */
  public static function getDefaultStartDate() {
    $timestamp = \Drupal::time()->getRequestTime();
    return gmdate(DateTimeItemInterface::DATETIME_STORAGE_FORMAT, $timestamp);
    return date(DateTimeItemInterface::DATETIME_STORAGE_FORMAT, $timestamp);
  }

  /**
+1 −1
Changes for modules/promotion/tests/src/Kernel/Entity/CouponTest.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -119,7 +119,7 @@ class CouponTest extends OrderKernelTestBase {

    $date_pattern = DateTimeItemInterface::DATETIME_STORAGE_FORMAT;
    $time = $this->container->get('datetime.time');
    $default_start_date = gmdate($date_pattern, $time->getRequestTime());
    $default_start_date = date($date_pattern, $time->getRequestTime());
    $this->assertEquals($default_start_date, $coupon->getStartDate()->format($date_pattern));
    $coupon->setStartDate(new DrupalDateTime('2017-01-01 12:12:12'));
    $this->assertEquals('2017-01-01 12:12:12 UTC', $coupon->getStartDate()->format('Y-m-d H:i:s T'));
+1 −1
Changes for modules/promotion/tests/src/Kernel/Entity/PromotionTest.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -168,7 +168,7 @@ class PromotionTest extends OrderKernelTestBase {

    $date_pattern = DateTimeItemInterface::DATETIME_STORAGE_FORMAT;
    $time = $this->container->get('datetime.time');
    $default_start_date = gmdate($date_pattern, $time->getRequestTime());
    $default_start_date = date($date_pattern, $time->getRequestTime());
    $this->assertEquals($default_start_date, $promotion->getStartDate()->format($date_pattern));
    $promotion->setStartDate(new DrupalDateTime('2017-01-01 12:12:12'));
    $this->assertEquals('2017-01-01 12:12:12 UTC', $promotion->getStartDate()->format('Y-m-d H:i:s T'));