X-Git-Url: https://git.ao2.it/tweeper.git/blobdiff_plain/4c4771f61019b68bdf3d6896995fe9fb24b5fd45..4c2e9862fdd7af1572f5a0fc90b030847b946ce8:/tweeper.php

diff --git a/tweeper.php b/tweeper.php
index 37b73f5..81f5f85 100644
--- a/tweeper.php
+++ b/tweeper.php
@@ -32,12 +32,20 @@ class Tweeper {
 
   public static function epoch_to_gmdate($timestamp)
   {
+    if (!is_numeric($timestamp) || is_nan($timestamp)) {
+      $timestamp = 0;
+    }
+
     return gmdate('D, d M Y H:i:s', $timestamp) . ' GMT';
   }
 
   public static function str_to_gmdate($date)
   {
     $timestamp = strtotime($date);
+    if (FALSE === $timestamp) {
+      $timestamp = 0;
+    }
+
     return Tweeper::epoch_to_gmdate($timestamp);
   }