Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Outlook date format #480

Merged
merged 2 commits into from
Nov 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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