mirror of
https://github.com/immich-app/immich.git
synced 2025-11-24 23:40:45 +09:00
* refactor(server): tsconfigs * chore: dummy commit * fix: start.sh * chore: restore original entry scripts
25 lines
634 B
TypeScript
25 lines
634 B
TypeScript
import { ExifDateTime } from 'exiftool-vendored';
|
|
import { isDecimalNumber } from '../numbers';
|
|
|
|
export function exifToDate(exifDate: string | Date | ExifDateTime | undefined): Date | null {
|
|
if (!exifDate) {
|
|
return null;
|
|
}
|
|
|
|
const date = exifDate instanceof ExifDateTime ? exifDate.toDate() : new Date(exifDate);
|
|
if (!isDecimalNumber(date.valueOf())) {
|
|
return null;
|
|
}
|
|
|
|
return date;
|
|
}
|
|
|
|
export function exifTimeZone(exifDate: string | Date | ExifDateTime | undefined): string | null {
|
|
const isExifDate = exifDate instanceof ExifDateTime;
|
|
if (!isExifDate) {
|
|
return null;
|
|
}
|
|
|
|
return exifDate.zone ?? null;
|
|
}
|