Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/date_fns/isDate/index.ts>default

date-fns Deno package
Go to Latest
function default
import { default } from "https://deno.land/x/date_fns@v2.22.0/isDate/index.ts";

Examples

// For a valid date: const result = isDate(new Date()) //=> true

// For an invalid date: const result = isDate(new Date(NaN)) //=> true

// For some value: const result = isDate('2014-02-31') //=> false

// For an object: const result = isDate({}) //=> false

Parameters

value: unknown
  • the value to check

Returns

value is Date

true if the given value is a date