diff --git a/core/modules/comment/lib/Drupal/comment/CommentFormController.php b/core/modules/comment/lib/Drupal/comment/CommentFormController.php index ecbe5b2..ae47486 100644 --- a/core/modules/comment/lib/Drupal/comment/CommentFormController.php +++ b/core/modules/comment/lib/Drupal/comment/CommentFormController.php @@ -110,7 +110,6 @@ public function form(array $form, array &$form_state) { if ($is_admin) { $author = $comment->name->value; $status = (isset($comment->status->value) ? $comment->status->value : COMMENT_NOT_PUBLISHED); - $date = (!empty($comment->date) ? $comment->date : DrupalDateTime::createFromTimestamp($comment->created->value)); if (empty($form_state['comment_preview'])) { $form['#title'] = $this->t('Edit comment %title', array( '%title' => $comment->subject->value, @@ -125,7 +124,11 @@ public function form(array $form, array &$form_state) { $author = ($comment->name->value ? $comment->name->value : ''); } $status = ($this->currentUser->hasPermission('skip comment approval') ? COMMENT_PUBLISHED : COMMENT_NOT_PUBLISHED); - $date = ''; + } + + $date = ''; + if ($comment->id()) { + $date = (!empty($comment->date) ? $comment->date : DrupalDateTime::createFromTimestamp($comment->created->value)); } // Add the author name field depending on the current user.