Apply bounds to timestamps during backup import

This commit is contained in:
Fedor Indutny 2025-01-08 18:22:56 -08:00 committed by GitHub
parent 8c57d243c0
commit 69ac276d0c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 172 additions and 45 deletions

View file

@ -207,8 +207,8 @@ export function formatDate(
});
}
const MAX_SAFE_DATE = 8640000000000000;
const MIN_SAFE_DATE = -8640000000000000;
export const MAX_SAFE_DATE = 8640000000000000;
export const MIN_SAFE_DATE = -8640000000000000;
export function toBoundedDate(timestamp: number): Date {
return new Date(Math.max(MIN_SAFE_DATE, Math.min(timestamp, MAX_SAFE_DATE)));