mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
* chore(server) Harden EXIF extraction * Remove unused function in timeutil * Remove deadcode
22 lines
466 B
TypeScript
22 lines
466 B
TypeScript
function createTimeUtils() {
|
|
const checkValidTimestamp = (timestamp: string): boolean => {
|
|
const parsedTimestamp = Date.parse(timestamp);
|
|
|
|
if (isNaN(parsedTimestamp)) {
|
|
return false;
|
|
}
|
|
|
|
const date = new Date(parsedTimestamp);
|
|
|
|
if (date.getFullYear() < 1583 || date.getFullYear() > 9999) {
|
|
return false;
|
|
}
|
|
|
|
return date.getFullYear() > 0;
|
|
};
|
|
|
|
return { checkValidTimestamp };
|
|
}
|
|
|
|
export const timeUtils = createTimeUtils();
|