Get the number of days in a month of the given date.
Get the number of days in a month of the given date.
// CommonJS
var getDaysInMonth = require('date-fns/getDaysInMonth')
// ES 2015 import getDaysInMonth from 'date-fns/getDaysInMonth'
// ESM
import { getDaysInMonth } from 'date-fns'
getDaysInMonth(date)
| Name | Description |
|---|---|
date |
the given date |
| Description |
|---|
|
the number of days in a month |
| Type | Description |
|---|---|
TypeError |
1 argument required |
// How many days are in February 2000? const result = getDaysInMonth(new Date(2000, 1)) //=> 29
© 2021 Sasha Koss and Lesha Koss
Licensed under the MIT License.
https://date-fns.org/v2.29.2/docs/getDaysInMonth