Skip to content

Commit

Permalink
Correction du setDate
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume DUBOST committed Feb 27, 2020
1 parent 663a6a6 commit 31f6995
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Extensions/GetSetDate.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ protected function setDateField($field_name, $date)
switch (true) {
case is_object($date) && 'DateTime' !== get_class($date):
case is_string($date) && !preg_match("#^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$#", trim($date)):
throw new \Exception("bad deleted_at provided", 400);
throw new \Exception("bad {$field_name} provided", 400);
default:
$this->deleted_at = $date instanceof \DateTime ? $date : new \DateTime($date);
$this->{$field_name} = $date instanceof \DateTime ? $date : new \DateTime($date);
}

return $this;
Expand Down

0 comments on commit 31f6995

Please sign in to comment.