Skip to main content
isDate - util - Node documentation
function isDate

Usage in Deno

import { isDate } from "node:util";
isDate(object: unknown): object is Date
Deprecated

Since v4.0.0 - Use types.isDate instead.

Returns true if the given object is a Date. Otherwise, returns false.

import util from 'node:util';

util.isDate(new Date());
// Returns: true
util.isDate(Date());
// false (without 'new' returns a String)
util.isDate({});
// Returns: false

Parameters

object: unknown

Return Type

object is Date