Skip to main content
@spa-tools/utilities

isToday()

The isToday() function checks if a date value equates to a date that is today.

Usage

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

const todayDate = new Date();
console.log(isToday(todayDate));
// --> true

console.log(isToday('2080-12-31'));
// --> false

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 that is today then returns true else returns false.