}
}
}
- // If all else fails, return the original string.
- return $str;
+
+ // If all else fails, return a standard duration or timestamp description.
+ $time = strtotime( $str, 0 );
+ if ( $time === false ) { // Unknown format. Return it as-is in case.
+ return $str;
+ } elseif ( $time !== strtotime( $str, 1 ) ) { // It's a relative timestamp.
+ // $time is relative to 0 so it's a duration length.
+ return $this->formatDuration( $time );
+ } else { // It's an absolute timestamp.
+ if ( $time === 0 ) {
+ // wfTimestamp() handles 0 as current time instead of epoch.
+ return $this->timeanddate( '19700101000000' );
+ } else {
+ return $this->timeanddate( $time );
+ }
+ }
}
/**