| | $authorName = htmlspecialchars( $m[1] ) . ' <email>'; |
| | $timestamp = (int)$m[2]; |
| | - $pattern = '/([-+])(\d{2})(\d{2})/'; |
| | - $tzString = preg_replace( $pattern, '$1$2:$3', $m[3] ); |
| | $dt = new DateTime( '@' . $timestamp ); |
| | + $offsetStr = $m[3]; |
| | + $sign = $offsetStr[0] === '-' ? -1 : 1; |
| | + $hours = (int)substr( $offsetStr, 1, 2 ); |
| | + $mins = (int)substr( $offsetStr, 3, 2 ); |
| | + $offsetSecs = $sign * ( $hours * 3600 + $mins * 60 ); |
| | + $tzName = timezone_name_from_abbr( '', $offsetSecs, 1 ) ?: |
| | + timezone_name_from_abbr( '', $offsetSecs, 0 ); |
| | |
| | - $dt->setTimezone( new DateTimeZone( $tzString ) ); |
| | + if( $tzName !== false ) { |
| | + $dt->setTimezone( new DateTimeZone( $tzName ) ); |
| | + } else { |
| | + $pattern = '/([-+])(\d{2})(\d{2})/'; |
| | + $tzString = preg_replace( $pattern, '$1$2:$3', $offsetStr ); |
| | |
| | - $commitDate = $dt->format( 'Y-m-d H:i:s P' ); |
| | + $dt->setTimezone( new DateTimeZone( $tzString ) ); |
| | + } |
| | + |
| | + $commitDate = $dt->format( 'Y-m-d H:i:s T' ); |
| | } |
| | |