MomentJS - Days in Month



This method will give the numbers of days in the current month.

Syntax

moment().daysInMonth();

Example

var a = moment().daysInMonth();

Output

Days in Month

Example

Let us check the days in a month for a given date using this method. Use the following code for this purpose −

var a = moment([2016, 1]).daysInMonth();

Output

daysInMonth

For February in 2016, it displays days as 29.

momentjs_formatting_date_and_time.htm
Advertisements