Fix UI for invalid timestamps
This commit is contained in:
parent
187d06fd69
commit
1c933af6ce
4 changed files with 18 additions and 4 deletions
|
@ -206,3 +206,10 @@ export function formatDate(
|
|||
year: 'numeric',
|
||||
});
|
||||
}
|
||||
|
||||
const MAX_SAFE_DATE = 8640000000000000;
|
||||
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)));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue