1.38.0isDate
Checks whether a value is an instance of Date and provides a TypeScript type guard for Date narrowing.
isDate(value):value is DateImplementation
The function uses the JavaScript instanceof operator to check whether the value is an instance of Date.
Type guard
The return type `value is Date` makes the function a TypeScript type guard. When it returns true, TypeScript can treat the value as a Date within the narrowed scope.
Invalid Date objects
This function checks the object's type, not whether the Date contains a valid timestamp. Therefore, an invalid Date object still returns true.
Parameters
valueunknownrequiredThe value to check.
Returns
value is DateReturns true when the value is an instance of Date; otherwise returns false. When true, TypeScript narrows the value to Date.
Examples
Basic usage
Check whether a value is a Date instance.
isDate(new Date());
// true
isDate("2026-09-24");
// falseType narrowing
The type guard narrows an unknown value to Date inside the conditional block.
const value: unknown = new Date();
if (isDate(value)) {
value.getTime();
// value is narrowed to Date
}Invalid Date
An invalid Date object is still an instance of Date, so it returns true.
const value = new Date("invalid");
isDate(value);
// trueOther values
Strings, numbers, null, undefined, and plain objects are not Date instances.
isDate("2026-09-24");
// false
isDate(0);
// false
isDate(null);
// false
isDate({});
// false