Skip to content

Commit

Permalink
fix: do not throw, log and return.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Thulin committed Oct 7, 2024
1 parent 555e841 commit 9e547fa
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions source/php/Component/Date/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,23 +210,18 @@ private function strToTime($date)
}

if(is_null($this->dateRegion)) {
throw new \Exception(
'Date Component: Date region must be
set to parse complex or native language date strings.'
);
error_log('Date Component: Date region must be set to parse complex or native language date strings.');
return $date;
}

if(is_null($this->dateTimeZone)) {
throw new \Exception(
'Date Component: Date timezone must be
set to parse complex or native language date strings.'
);
error_log('Date Component: Date timezone must be set to parse complex or native language date strings.');
return $date;
}

if(class_exists('IntlDateFormatter') === false) {
throw new \Exception(
'Date Component: IntlDateFormatter class is not available. Parsing of localized dates is not possible.'
);
error_log('Date Component: IntlDateFormatter class is not available.');
return $date;
}

// Create the IntlDateFormatter to parse the date string
Expand Down

0 comments on commit 9e547fa

Please sign in to comment.