Jelajahi Sumber

added validation of timezone. This solves strtotime returning -1 because of a
non valid date format.

stekkel 23 tahun lalu
induk
melakukan
7403696be7
1 mengubah file dengan 4 tambahan dan 1 penghapusan
  1. 4 1
      functions/date.php

+ 4 - 1
functions/date.php

@@ -272,6 +272,10 @@ function getTimeStamp($dateParts) {
      * Since the day of week is optional, this check is needed.
      * Since the day of week is optional, this check is needed.
      */
      */
 
 
+    /* validate zone before we uses strtotime */
+    if (isset($dateParts[6]) && $dateParts[6]{0} != '(') {
+        $dateParts[6] = '('.$dateParts[6].')';
+    }
     $string = implode (' ', $dateParts);
     $string = implode (' ', $dateParts);
 
 
     if (! isset($dateParts[4])) {
     if (! isset($dateParts[4])) {
@@ -284,7 +288,6 @@ function getTimeStamp($dateParts) {
     if (intval(trim($dateParts[0])) > 0) {
     if (intval(trim($dateParts[0])) > 0) {
         return getGMTSeconds(strtotime($string), $dateParts[4]);
         return getGMTSeconds(strtotime($string), $dateParts[4]);
     }
     }
-
     return getGMTSeconds(strtotime($string), $dateParts[5]);
     return getGMTSeconds(strtotime($string), $dateParts[5]);
 }
 }