1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-04 02:46:47 +01:00

fix(server): exif time extraction (#2583)

This commit is contained in:
Michel Heusschen 2023-05-27 23:24:07 +02:00 committed by GitHub
parent e41e0df27e
commit fd4357cf23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -115,12 +115,12 @@ export class MetadataExtractionProcessor {
}) })
: {}; : {};
const exifToDate = (exifDate: string | ExifDateTime | undefined) => { const exifToDate = (exifDate: string | Date | ExifDateTime | undefined) => {
if (!exifDate) { if (!exifDate) {
return null; return null;
} }
const date = typeof exifDate === 'string' ? new Date(exifDate) : exifDate.toDate(); const date = exifDate instanceof ExifDateTime ? exifDate.toDate() : new Date(exifDate);
if (isNaN(date.valueOf())) { if (isNaN(date.valueOf())) {
return null; return null;
} }
@ -128,10 +128,9 @@ export class MetadataExtractionProcessor {
return date; return date;
}; };
const exifTimeZone = (exifDate: string | ExifDateTime | undefined) => { const exifTimeZone = (exifDate: string | Date | ExifDateTime | undefined) => {
if (!exifDate) return null; const isExifDate = exifDate instanceof ExifDateTime;
if (!isExifDate) {
if (typeof exifDate === 'string') {
return null; return null;
} }