diff --git a/core/modules/node/lib/Drupal/node/NodeStorageController.php b/core/modules/node/lib/Drupal/node/NodeStorageController.php index 90152ca..d2fe033 100644 --- a/core/modules/node/lib/Drupal/node/NodeStorageController.php +++ b/core/modules/node/lib/Drupal/node/NodeStorageController.php @@ -93,7 +93,8 @@ protected function invokeHook($hook, EntityInterface $node) { * Overrides Drupal\Core\Entity\DatabaseStorageController::preSave(). */ protected function preSave(EntityInterface $node) { - // Before saving the node, set changed and revision times. + // Before saving the node, set created and changed times. + $node->created = empty($node->created) ? REQUEST_TIME : $node->created; $node->changed = REQUEST_TIME; // If this is being published for the first time, set the published time. diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 26a589f..47ad2c2 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -977,7 +977,7 @@ function node_revision_load($vid = NULL) { } /** - * Prepares a node for saving by populating the author and creation date. + * Prepares a node for saving by populating the author and published date. * * @param Drupal\node\Node $node * A node object. @@ -1004,14 +1004,6 @@ function node_submit(Node $node) { $node->revision_uid = $user->uid; } - if (!empty($node->date)) { - $node_created = new DrupalDateTime($node->date); - $node->created = $node_created->getTimestamp(); - } - else { - $node->created = REQUEST_TIME; - } - if (!empty($node->published_date)) { $node_published = new DrupalDateTime($node->published_date); $node->published = $node_published->getTimestamp();