Monday, May 11, 2026
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
32514 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6892 POSTS0 COMMENTS
Nicole Veronica
12012 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12107 POSTS0 COMMENTS
Shaida Kate Naidoo
7016 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6975 POSTS0 COMMENTS
Umr Jansen
6963 POSTS0 COMMENTS