Skip to main content


Returns the number of days in a given month. Note that month indexes start at 0. If no arguments are provided, it returns data about the current month.


import { getDaysInMonth } from 'easy-dates';

getDaysInMonth(month, year)

Prop types

The month can be a number, representing the index of the month, or can be the name of the month.

yearnumbernocurrent year
month string or numbernocurrent month


using two number arguments
getDaysInMonth(1, 2022) // 28
using a string for the month
getDaysInMonth("feb", 2022) // 28 
when no args are used, the current month (Feb) is returned
getDaysInMonth() // 28