Browse Source

If date can not be parsed, do not display date header at all (better than wrong date header)

Thijs Kinkhorst 23 năm trước cách đây
mục cha
commit
78b99f18b1
1 tập tin đã thay đổi với 10 bổ sung0 xóa
  1. 10 0
      functions/date.php

+ 10 - 0
functions/date.php

@@ -19,6 +19,12 @@ require_once( '../functions/constants.php' );
 // corrects a time stamp to be the local time
 function getGMTSeconds($stamp, $gmt) {
     global $invert_time;
+
+    // date couldn't be parsed
+    if ($stamp == -1) {
+        return -1;
+    }
+
     if (($gmt == 'Pacific') || ($gmt == 'PST')) {
         $gmt = '-0800'; 
     } else if (($gmt == 'EDT')) {
@@ -179,6 +185,10 @@ function getLongDateString( $stamp ) {
 
     global $hour_format;
     
+    if ($stamp == -1) {
+        return '';
+    }
+
     if ( $hour_format == SMPREF_TIME_12HR ) {
         $date_format = _("D, F j, Y g:i a");
     } else {