Skip to content

Commit

Permalink
Handle Outlook date format (ddeboer#480)
Browse files Browse the repository at this point in the history
  • Loading branch information
gajosadrian authored Nov 13, 2020
1 parent d439d09 commit 337b65d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Message/AbstractMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ final public function getDate(): ?\DateTimeImmutable
$alteredValue = \str_replace(',', '', $alteredValue);
$alteredValue = (string) \preg_replace('/^[a-zA-Z]+ ?/', '', $alteredValue);
$alteredValue = (string) \preg_replace('/\(.*\)/', '', $alteredValue);
$alteredValue = (string) \preg_replace('/\<.*\>/', '', $alteredValue);
$alteredValue = (string) \preg_replace('/\bUT\b/', 'UTC', $alteredValue);
if (0 === \preg_match('/\d\d:\d\d:\d\d.* [\+\-]\d\d:?\d\d/', $alteredValue)) {
$alteredValue .= ' +0000';
Expand Down
1 change: 1 addition & 0 deletions tests/MessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,7 @@ public function provideDateCases(): array
['2014-09-15T05:25:04+0000', 'Mon, 15 09 2014 05:25:04'], // Non compliant to RFC2822#section-3.3
['2014-09-30T10:50:58+0200', 'Tue, 30 Sep 2014 10:50:58 +0200 (added by [email protected]) '],
['2014-09-30T10:50:58+0200', ' (added by [email protected]) Tue, 30 Sep 2014 10:50:58 +0200'],
['2020-10-27T10:25:58+0000', 'Tue, 27 Oct 2020 10:25:58 +0000 <AM8PR08MB565014C82DF69A14167D12829D160@AM8PR08MB5650.eurprd08.prod.outlook.com>'],
];
}

Expand Down

0 comments on commit 337b65d

Please sign in to comment.