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) => {
|
||||
if (!exifDate) return null;
|
||||
|
||||
if (typeof exifDate === 'string') {
|
||||
return new Date(exifDate);
|
||||
if (!exifDate) {
|
||||
return null;
|
||||
}
|
||||
|
||||
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) => {
|
||||
|
|
Loading…
Reference in a new issue