Set the day of the year to the given date.
Set the day of the year to the given date.
// CommonJS var setDayOfYear = require('date-fns/setDayOfYear')
// ES 2015 import setDayOfYear from 'date-fns/setDayOfYear'
// ESM import { setDayOfYear } from 'date-fns'
setDayOfYear(date, dayOfYear)
Name | Description |
---|---|
date |
the date to be changed |
dayOfYear |
the day of the year of the new date |
Description |
---|
the new date with the day of the year set |
Type | Description |
---|---|
TypeError |
2 arguments required |
// Set the 2nd day of the year to 2 July 2014: const result = setDayOfYear(new Date(2014, 6, 2), 2) //=> Thu Jan 02 2014 00:00:00
© 2021 Sasha Koss and Lesha Koss
Licensed under the MIT License.
https://date-fns.org/v2.29.2/docs/setDayOfYear