mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-05-01 22:01:49 +01:00
Avoid mute timeouts with invalid delay values
Co-authored-by: trevor-signal <131492920+trevor-signal@users.noreply.github.com>
This commit is contained in:
@@ -210,6 +210,8 @@ export function formatDate(
|
||||
export const MAX_SAFE_DATE = 8640000000000000;
|
||||
export const MIN_SAFE_DATE = -8640000000000000;
|
||||
|
||||
export const MAX_SAFE_TIMEOUT_DELAY = 2147483647; // max 32-bit signed integer
|
||||
|
||||
export function toBoundedDate(timestamp: number): Date {
|
||||
return new Date(Math.max(MIN_SAFE_DATE, Math.min(timestamp, MAX_SAFE_DATE)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user