Bug 458850

Summary: not valid createdate
Product: [Applications] digikam Reporter: erik.lindsay
Component: Plugin-Generic-TimeAdjustAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles, metzpinguin
Priority: NOR    
Version: 7.8.0   
Target Milestone: ---   
Platform: macOS (DMG)   
OS: macOS   
Latest Commit: Version Fixed In: 8.0.0
Sentry Crash Report:
Attachments: Sample photo with invalid date stamp
version

Description erik.lindsay 2022-09-07 21:16:40 UTC
Created attachment 151906 [details]
Sample photo with invalid date stamp

SUMMARY
I have some photos (see example attached) that appear to have an invalid EXIF CreateDate and/or DateTimeOriginal. Under Metadata > ExifTool I see values like "06.25.2009 17:53". However, the date shown in the captions tab is "1/5/2014 19:10:48" and seems to come from the file metadata. I tried to use the adjust date & time tool, but all the timestamp options show as not valid, and there is no way to fix this in Digikam.


STEPS TO REPRODUCE
1. View file metadata dates and compare to caption date
2. Open Adjust date and time tool
3. Timestamp used column always shows "not valid" no matter which timestamp you use

OBSERVED RESULT
EXIF CreateDate and caption date are different, and there is no way to correct it automatically 

EXPECTED RESULT
Digikam should be able to correct for invalid date formats, either through a separate tool, or adding some settings in in the adjust date and time tool to tell it what format the dates are in. 

SOFTWARE/OS VERSIONS
macOS: Version 13.0 Beta (22A5331f)
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 5.96.0
Qt Version: 5.15.3 (built against 5.15.3)
Comment 1 caulier.gilles 2022-09-07 23:28:40 UTC
Following the Qt version used, you don't use the last 7.8.0. Please try to reproduce the problem with the last digiKam stable just released.

Gilles Caulier
Comment 2 erik.lindsay 2022-09-07 23:56:39 UTC
Created attachment 151909 [details]
version
Comment 3 erik.lindsay 2022-09-07 23:58:06 UTC
(In reply to caulier.gilles from comment #1)
> Following the Qt version used, you don't use the last 7.8.0. Please try to
> reproduce the problem with the last digiKam stable just released.
> 
> Gilles Caulier

I am using version 7.8.0 (See attachment I just added). I also checked for updates, and there are none.
Comment 4 Maik Qualmann 2022-09-08 06:32:41 UTC
Your date stored in the metadata is not a valid ISO-8601 (Qt::ISODate). It has the wrong day-month-year order. Therefore, the text date provided by Exiv2 cannot be converted into a valid QDateTime using Qt::ISODate.

Maik
Comment 5 Maik Qualmann 2022-09-08 06:40:44 UTC
Although ExifTool displays the wrong date. When trying to copy the metadata into an image container, ExifTool even removes this date metadata.
You have no choice but to set a completely new date manually and write it to the metadata.

Maik
Comment 6 Maik Qualmann 2022-09-08 08:25:18 UTC
What we can do is add the ability to input a date format string in the Timeadjust tool. In your case, the entry would be something like "dd.MM.yyyy hh:mm"

Maik
Comment 7 erik.lindsay 2022-09-08 12:59:30 UTC
(In reply to Maik Qualmann from comment #6)
> What we can do is add the ability to input a date format string in the
> Timeadjust tool. In your case, the entry would be something like "dd.MM.yyyy
> hh:mm"
> 
> Maik

Thanks for the explanation. That would be a great solution!
Comment 8 Maik Qualmann 2022-09-08 17:08:44 UTC
Git commit 3e0bbaefbd1ff2cbdebb401b66fc42e4a93fc13e by Maik Qualmann.
Committed on 08/09/2022 at 17:07.
Pushed by mqualmann into branch 'master'.

add fuzzy EXIF date detection to the time adjust tool
We have a powerful function to extract the date from filenames.
This function is now used to extract an invalid EXIF date.
FIXED-IN: 8.0.0

M  +2    -1    NEWS
M  +19   -1    core/dplugins/bqm/metadata/timeadjust/timeadjust.cpp
M  +19   -1    core/dplugins/generic/metadata/timeadjust/timeadjustthread.cpp
M  +12   -4    core/libs/timeadjust/timeadjustcontainer.cpp
M  +5    -2    core/libs/timeadjust/timeadjustcontainer.h
M  +9    -6    core/libs/timeadjust/timeadjustsettings.cpp

https://invent.kde.org/graphics/digikam/commit/3e0bbaefbd1ff2cbdebb401b66fc42e4a93fc13e