Skip to content

Commit

Permalink
- Fixed an issue with dates. (#345)
Browse files Browse the repository at this point in the history
- I was receiving the following exception with dates:
- EXCEPTION: Invalid message date. ID:VI1PR07MB4766210AE35AE91886D2D766E61F9@VI1PR07MB4766.eurprd07.prod.outlook.com Date:Sat, 10, Dec 2022 09:35:19 +0100/Sat, 10, Dec 2022 09:35:19 +0100
- I added a fix for those date to be parsed correctly. Now it works fine.
  • Loading branch information
amorebietakoUdala committed Dec 14, 2022
1 parent 8e95709 commit 5748cf1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,8 @@ private function parseDate($header) {
case preg_match('/([A-Z]{2,3}\,\ [0-9]{1,2}\ [A-Z]{2,3}\ [0-9]{4}\ [0-9]{1,2}\:[0-9]{1,2}\:[0-9]{1,2}\ UT)+$/i', $date) > 0:
$date .= 'C';
break;
case preg_match('/([A-Z]{2,3}\,\ [0-9]{1,2}[\,]\ [A-Z]{2,3}\ [0-9]{4}\ [0-9]{1,2}\:[0-9]{1,2}\:[0-9]{1,2}\ [\-|\+][0-9]{4})+$/i', $date) > 0:
$date = str_replace(',', '', $date);
case preg_match('/([A-Z]{2,3}\,\ [0-9]{1,2}\ [A-Z]{2,3}\ [0-9]{4}\ [0-9]{1,2}\:[0-9]{1,2}\:[0-9]{1,2}\ \+[0-9]{2,4}\ \(\+[0-9]{1,2}\))+$/i', $date) > 0:
case preg_match('/([A-Z]{2,3}[\,|\ \,]\ [0-9]{1,2}\ [A-Z]{2,3}\ [0-9]{4}\ [0-9]{1,2}\:[0-9]{1,2}\:[0-9]{1,2}.*)+$/i', $date) > 0:
case preg_match('/([A-Z]{2,3}\,\ [0-9]{1,2}\ [A-Z]{2,3}\ [0-9]{4}\ [0-9]{1,2}\:[0-9]{1,2}\:[0-9]{1,2}\ [\-|\+][0-9]{4}\ \(.*)\)+$/i', $date) > 0:
Expand Down

0 comments on commit 5748cf1

Please sign in to comment.