You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
302 B
TypeScript
12 lines
302 B
TypeScript
const ONE_DAY = 24 * 60 * 60 * 1000;
|
|
|
|
export function isLinkPreviewDateValid(value: unknown): value is number {
|
|
const maximumLinkPreviewDate = Date.now() + ONE_DAY;
|
|
return (
|
|
typeof value === 'number' &&
|
|
value !== 0 &&
|
|
Number.isFinite(value) &&
|
|
value < maximumLinkPreviewDate
|
|
);
|
|
}
|