mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Made the date thing throw a FF error.
This commit is contained in:
parent
223ea80860
commit
c0d62237fc
@ -3,6 +3,9 @@
|
|||||||
namespace FireflyIII\Helpers\Csv\Converter;
|
namespace FireflyIII\Helpers\Csv\Converter;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
|
use InvalidArgumentException;
|
||||||
|
use Log;
|
||||||
use Session;
|
use Session;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -19,8 +22,16 @@ class Date extends BasicConverter implements ConverterInterface
|
|||||||
public function convert()
|
public function convert()
|
||||||
{
|
{
|
||||||
$format = Session::get('csv-date-format');
|
$format = Session::get('csv-date-format');
|
||||||
|
try {
|
||||||
|
$date = Carbon::createFromFormat($format, $this->value);
|
||||||
|
} catch (InvalidArgumentException $e) {
|
||||||
|
Log::error('Date conversion error: ' . $e->getMessage() . '. Value was "' . $this->value . '", format was "' . $format . '".');
|
||||||
|
|
||||||
|
$message = trans('firefly.csv_date_parse_error', ['format' => $format, 'value' => $this->value]);
|
||||||
|
|
||||||
|
throw new FireflyException($message);
|
||||||
|
}
|
||||||
|
|
||||||
$date = Carbon::createFromFormat($format, $this->value);
|
|
||||||
|
|
||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user