Skip to main content
@spa-tools/utilities

isFuture()

The isFuture() function checks if a date value equates to a date that is in the future.

Usage

import { isFuture } from '@spa-tools/utilities';

const pastDate = new Date('2022-01-01');
console.log(isFuture(pastDate));
// --> false

console.log(isFuture('2080-12-31'));
// --> true

Arguments

NameTypeRequired?Description
datestring | number | DateyesThe date value to check as either date string, timestamp integer, or date object

Returns

boolean - If value of date equates to a date in the future then returns true else returns false.