diff --git a/lib/Drupal/Component/Datetime/DateTimePlus.php b/lib/Drupal/Component/Datetime/DateTimePlus.php
index 952b6cb6dc..1fc5ab1212 100644
--- a/lib/Drupal/Component/Datetime/DateTimePlus.php
+++ b/lib/Drupal/Component/Datetime/DateTimePlus.php
@@ -201,7 +201,7 @@ class DateTimePlus {
       throw new \InvalidArgumentException('The timestamp must be numeric.');
     }
     $datetime = new static('', $timezone, $settings);
-    $datetime->setTimestamp($timestamp);
+    $datetime->setTimestamp((int) $timestamp);
     return $datetime;
   }

