mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Catch possible invalid format exception & return "Invalid date!"
This commit is contained in:
parent
7c01b3bb64
commit
b88533d3d2
@ -99,10 +99,13 @@ trait MakesDates
|
|||||||
|
|
||||||
public function translateDate($date, $format, $locale)
|
public function translateDate($date, $format, $locale)
|
||||||
{
|
{
|
||||||
|
|
||||||
Carbon::setLocale($locale);
|
Carbon::setLocale($locale);
|
||||||
|
|
||||||
|
try {
|
||||||
return Carbon::parse($date)->translatedFormat($format);
|
return Carbon::parse($date)->translatedFormat($format);
|
||||||
|
} catch(\Exception $e) {
|
||||||
|
return 'Invalid date!';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user