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) {
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())) {
return null;
}
@ -128,10 +128,9 @@ export class MetadataExtractionProcessor {
return date;
};
const exifTimeZone = (exifDate: string | ExifDateTime | undefined) => {
if (!exifDate) return null;
if (typeof exifDate === 'string') {
const exifTimeZone = (exifDate: string | Date | ExifDateTime | undefined) => {
const isExifDate = exifDate instanceof ExifDateTime;
if (!isExifDate) {
return null;
}