mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-02 03:51:18 +00:00
improved request and balance range date handling
This commit is contained in:
@@ -402,21 +402,21 @@ trait ConvertsDataTypes
|
||||
*/
|
||||
protected function getCarbonDate(string $field): ?Carbon
|
||||
{
|
||||
$result = null;
|
||||
$data = (string)$this->get($field);
|
||||
Log::debug(sprintf('Date string is "%s"', $data));
|
||||
|
||||
Log::debug(sprintf('Date string is "%s"', (string)$this->get($field)));
|
||||
if ('' === $data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
$result = '' !== (string)$this->get($field) ? new Carbon((string)$this->get($field), config('app.timezone')) : null;
|
||||
return new Carbon($data, config('app.timezone'));
|
||||
} catch (InvalidFormatException) {
|
||||
// @ignoreException
|
||||
Log::debug(sprintf('Exception when parsing date "%s".', $this->get($field)));
|
||||
}
|
||||
if (!$result instanceof Carbon) {
|
||||
Log::debug(sprintf('Exception when parsing date "%s".', $this->get($field)));
|
||||
Log::debug(sprintf('Exception when parsing date "%s".', $data));
|
||||
}
|
||||
|
||||
return $result;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user