Wednesday, November 12, 2025
HomeLanguagesJavascriptLodash _.isDate() Method

Lodash _.isDate() Method

The Lodash _.isDate() Method Checks if the given value can be classified as Date Object or not. 

Syntax:

_.isDate( Value )

Parameters: This method accepts a single parameter as mentioned above and described below:

  • Value: This parameter holds the value that needs to be Checked for Date Object.

Return Value: This method returns a Boolean value(Returns true if the given value is a Date Object, else false).

Example 1: 




// Defining Lodash variable
const _ = require('lodash'); 
     
var val = new Date;
// Checking for Date Object
console.log("The Value is Date : " 
            +_.isDate(val));


Output:

The Value is Date : true

Example 2: The following example returns false as the value is a string object, not a date object.




// Defining Lodash variable
const _ = require('lodash'); 
     
var val = "15/07/2020";
  
// Checking for Date Object
console.log("The Value is Date : " 
            +_.isDate(val));


Output:

The Value is Date : false

Note: This will not work in normal JavaScript because it requires the lodash library to be installed. 

Lodash library can be installed using npm install lodash.

RELATED ARTICLES

Most Popular

Dominic
32399 POSTS0 COMMENTS
Milvus
95 POSTS0 COMMENTS
Nango Kala
6763 POSTS0 COMMENTS
Nicole Veronica
11916 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11983 POSTS0 COMMENTS
Shaida Kate Naidoo
6889 POSTS0 COMMENTS
Ted Musemwa
7141 POSTS0 COMMENTS
Thapelo Manthata
6834 POSTS0 COMMENTS
Umr Jansen
6838 POSTS0 COMMENTS