mirror of
https://github.com/immich-app/immich.git
synced 2025-01-21 03:02:44 +01:00
fix(server): invalid exif date string (#2580)
This commit is contained in:
parent
f370dc3929
commit
e41e0df27e
1 changed files with 8 additions and 5 deletions
|
@ -116,13 +116,16 @@ export class MetadataExtractionProcessor {
|
||||||
: {};
|
: {};
|
||||||
|
|
||||||
const exifToDate = (exifDate: string | ExifDateTime | undefined) => {
|
const exifToDate = (exifDate: string | ExifDateTime | undefined) => {
|
||||||
if (!exifDate) return null;
|
if (!exifDate) {
|
||||||
|
return null;
|
||||||
if (typeof exifDate === 'string') {
|
|
||||||
return new Date(exifDate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return exifDate.toDate();
|
const date = typeof exifDate === 'string' ? new Date(exifDate) : exifDate.toDate();
|
||||||
|
if (isNaN(date.valueOf())) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return date;
|
||||||
};
|
};
|
||||||
|
|
||||||
const exifTimeZone = (exifDate: string | ExifDateTime | undefined) => {
|
const exifTimeZone = (exifDate: string | ExifDateTime | undefined) => {
|
||||||
|
|
Loading…
Reference in a new issue