VOOZH about

URL: https://www.geeksforgeeks.org/node-js/node-js-date-and-time-date-isleapyear-method/

⇱ Node.js date-and-time Date.isLeapYear() Method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Node.js date-and-time Date.isLeapYear() Method

Last Updated : 31 Jan, 2023

The date-and-time.Date.isLeapYear() is a minimalist collection of functions for manipulating JS date and time module which is used to check if the given year is a leap year or not.

Required Module: Install the module by npm or used it locally.

By using npm:

npm install date-and-time --save

By using CDN link:

<script src="/path/to/date-and-time.min.js"></script>
 

Syntax:

const isLeapYear(y)

Parameters: This Method takes a string of year.

Return Value: This method returns the Boolean value true if and only if the string of year is leap.

Example 1:

Run index.js file using below command:

node index.js

Output:

This is not a leap year

Example 2:

Run index.js file using below command:

node index.js

Output:

This is a leap year

Reference: https://github.com/knowledgecode/date-and-time#isleapyeary

Comment

Explore