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