mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-30 18:41:08 +00:00
Fix issue with time stamps.
This commit is contained in:
@@ -140,8 +140,14 @@ class ImportableConverter
|
|||||||
$result = null;
|
$result = null;
|
||||||
if (null !== $date) {
|
if (null !== $date) {
|
||||||
try {
|
try {
|
||||||
$object = Carbon::createFromFormat($this->config['date-format'] ?? 'Ymd', $date);
|
// add exclamation mark for better parsing. http://php.net/manual/en/datetime.createfromformat.php
|
||||||
$result = $object->format('Y-m-d');
|
$dateFormat = $this->config['date-format'] ?? 'Ymd';
|
||||||
|
if ('!' !== $dateFormat{0}) {
|
||||||
|
$dateFormat = '!' . $dateFormat;
|
||||||
|
}
|
||||||
|
$object = Carbon::createFromFormat($dateFormat, $date);
|
||||||
|
$result = $object->format('Y-m-d H:i:s');
|
||||||
|
Log::debug(sprintf('createFromFormat: Turning "%s" into "%s" using "%s"', $date, $result, $this->config['date-format'] ?? 'Ymd'));
|
||||||
} catch (InvalidDateException|InvalidArgumentException $e) {
|
} catch (InvalidDateException|InvalidArgumentException $e) {
|
||||||
Log::error($e->getMessage());
|
Log::error($e->getMessage());
|
||||||
Log::error($e->getTraceAsString());
|
Log::error($e->getTraceAsString());
|
||||||
@@ -213,7 +219,7 @@ class ImportableConverter
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
'type' => $transactionType,
|
'type' => $transactionType,
|
||||||
'date' => $this->convertDateValue($importable->date) ?? Carbon::now()->format('Y-m-d'),
|
'date' => $this->convertDateValue($importable->date) ?? Carbon::now()->format('Y-m-d H:i:s'),
|
||||||
'tags' => $importable->tags,
|
'tags' => $importable->tags,
|
||||||
'user' => $this->importJob->user_id,
|
'user' => $this->importJob->user_id,
|
||||||
'notes' => $importable->note,
|
'notes' => $importable->note,
|
||||||
|
Reference in New Issue
Block a user