Skip to content
This repository has been archived by the owner on Mar 29, 2024. It is now read-only.

Commit

Permalink
silent wrongly formatted date expression errors
Browse files Browse the repository at this point in the history
  • Loading branch information
xavierlacot committed Jul 21, 2023
1 parent 6d6c75d commit ac39ace
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/ForecastReminder/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,15 @@ private function extractStartDateFromtext(string $text): \DateTime
}

$text = str_replace(' and ', ', ' . $sign, $text);
$datetime = new \DateTime($text);

if (false === \DateTime::getLastErrors()) {
return $datetime;
try {
$datetime = new \DateTime($text);

if (false === \DateTime::getLastErrors()) {

This comment has been minimized.

Copy link
@lyrixx

lyrixx Jul 21, 2023

Member

dead code ?

return $datetime;
}
} catch (\Exception) {
// silent the wrongly formatted date expression errors
}

return new \DateTime('+1 day');
Expand Down

0 comments on commit ac39ace

Please sign in to comment.