diff --git a/core/includes/common.inc b/core/includes/common.inc index 769b7f0..d71f95a 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -5,7 +5,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Drupal\Component\Utility\NestedArray; use Drupal\Core\Cache\CacheBackendInterface; -use Drupal\Core\Datetime\DrupalDate; +use Drupal\Component\Datetime\DrupalDate; use Drupal\Core\Database\Database; use Drupal\Core\Template\Attribute; diff --git a/core/lib/Drupal/Component/Datetime/DateObject.php b/core/lib/Drupal/Component/Datetime/DateObject.php index 543d49b..17fb2ae 100644 --- a/core/lib/Drupal/Component/Datetime/DateObject.php +++ b/core/lib/Drupal/Component/Datetime/DateObject.php @@ -258,7 +258,7 @@ public function prepareTimezone($timezone) { // If the system timezone is missing, use 'UTC'. if (empty($timezone_adjusted) || !$timezone_adjusted instanceOf \DateTimezone) { $system_timezone = date_default_timezone_get(); - $timezone_name = !empty($system_timezone) ? $system_timezone: 'UTC'; + $timezone_name = !empty($system_timezone) ? $system_timezone : 'UTC'; $timezone_adjusted = new \DateTimeZone($timezone_name); } @@ -670,7 +670,7 @@ function format($format, $settings = array()) { // If we have what we need to use the IntlDateFormatter, do so. if ($this->canUseIntl() && $format_string_type == self::INTL) { - $calendartype = \IntlDateFormatter::GREGORIAN; + $calendar_type = \IntlDateFormatter::GREGORIAN; // If we have information about a calendar and it's not already // in the locale, add it. @@ -680,12 +680,12 @@ function format($format, $settings = array()) { // If we're working with a non-gregorian calendar, indicate that. if (stristr($locale, '@calendar=') && !stristr($locale, '@calendar=' . SELF::CALENDAR)) { - $calendartype = \IntlDateFormatter::TRADITIONAL; + $calendar_type = \IntlDateFormatter::TRADITIONAL; } $datetype = !empty($settings['datetype']) ? $settings['datetype'] : \IntlDateFormatter::FULL; $timetype = !empty($settings['timetype']) ? $settings['timetype'] : \IntlDateFormatter::FULL; - $formatter = new \IntlDateFormatter($locale, $datetype, $timetype, $timezone, $calendartype); + $formatter = new \IntlDateFormatter($locale, $datetype, $timetype, $timezone, $calendar_type); $formatter->setLenient($lenient); $value = $formatter->format($format); } @@ -700,4 +700,4 @@ function format($format, $settings = array()) { } return $value; } -} \ No newline at end of file +} diff --git a/core/lib/Drupal/Component/Datetime/DrupalDate.php b/core/lib/Drupal/Component/Datetime/DrupalDate.php index f13e8d3..ba42ca4 100644 --- a/core/lib/Drupal/Component/Datetime/DrupalDate.php +++ b/core/lib/Drupal/Component/Datetime/DrupalDate.php @@ -4,7 +4,7 @@ * @file * Definition of DrupalDate. */ -namespace Drupal\Core\Datetime; +namespace Drupal\Component\Datetime; use Drupal\Component\Datetime\DateObject; diff --git a/core/lib/Drupal/Core/TypedData/Type/Date.php b/core/lib/Drupal/Core/TypedData/Type/Date.php index f081830..c5ed4ab 100644 --- a/core/lib/Drupal/Core/TypedData/Type/Date.php +++ b/core/lib/Drupal/Core/TypedData/Type/Date.php @@ -7,7 +7,7 @@ namespace Drupal\Core\TypedData\Type; -use Drupal\Core\Datetime\DrupalDate; +use Drupal\Component\Datetime\DrupalDate; use Drupal\Core\TypedData\TypedDataInterface; use InvalidArgumentException; diff --git a/core/modules/comment/lib/Drupal/comment/CommentFormController.php b/core/modules/comment/lib/Drupal/comment/CommentFormController.php index 9613320..c2923e2 100644 --- a/core/modules/comment/lib/Drupal/comment/CommentFormController.php +++ b/core/modules/comment/lib/Drupal/comment/CommentFormController.php @@ -7,7 +7,7 @@ namespace Drupal\comment; -use Drupal\Core\Datetime\DrupalDate; +use Drupal\Component\Datetime\DrupalDate; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityFormController; diff --git a/core/modules/node/lib/Drupal/node/NodeFormController.php b/core/modules/node/lib/Drupal/node/NodeFormController.php index ff5ff6d..7a65341 100644 --- a/core/modules/node/lib/Drupal/node/NodeFormController.php +++ b/core/modules/node/lib/Drupal/node/NodeFormController.php @@ -7,7 +7,7 @@ namespace Drupal\node; -use Drupal\Core\Datetime\DrupalDate; +use Drupal\Component\Datetime\DrupalDate; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityFormController; diff --git a/core/modules/node/node.module b/core/modules/node/node.module index ede29a1..0dadcbd 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -14,7 +14,7 @@ use Drupal\Core\Database\Query\AlterableInterface; use Drupal\Core\Database\Query\SelectExtender; use Drupal\Core\Database\Query\SelectInterface; -use Drupal\Core\Datetime\DrupalDate; +use Drupal\Component\Datetime\DrupalDate; use Drupal\Core\Template\Attribute; use Drupal\node\Node; use Drupal\file\File; @@ -1107,8 +1107,8 @@ function node_submit($node) { if (!empty($node->revision)) { $node->revision_uid = $user->uid; } - $date = new DrupalDate($node->date); - $node->created = $date->getTimestamp(); + $node_created = new DrupalDate(!empty($node->date) ? $node->date : REQUEST_TIME); + $node->created = $node_created->getTimestamp(); $node->validated = TRUE; return $node; diff --git a/core/modules/system/lib/Drupal/system/Tests/TypedData/TypedDataTest.php b/core/modules/system/lib/Drupal/system/Tests/TypedData/TypedDataTest.php index bc3863b..d1d8b92 100644 --- a/core/modules/system/lib/Drupal/system/Tests/TypedData/TypedDataTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/TypedData/TypedDataTest.php @@ -8,7 +8,7 @@ namespace Drupal\system\Tests\TypedData; use Drupal\simpletest\WebTestBase; -use Drupal\Core\Datetime\DrupalDate; +use Drupal\Component\Datetime\DrupalDate; use DateInterval; /**