Browse Source

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

stekkel 23 years ago
parent
commit
7403696be7
1 changed files with 4 additions and 1 deletions
  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.
      */
 
+    /* validate zone before we uses strtotime */
+    if (isset($dateParts[6]) && $dateParts[6]{0} != '(') {
+        $dateParts[6] = '('.$dateParts[6].')';
+    }
     $string = implode (' ', $dateParts);
 
     if (! isset($dateParts[4])) {
@@ -284,7 +288,6 @@ function getTimeStamp($dateParts) {
     if (intval(trim($dateParts[0])) > 0) {
         return getGMTSeconds(strtotime($string), $dateParts[4]);
     }
-
     return getGMTSeconds(strtotime($string), $dateParts[5]);
 }