Set the day of the month to the given date.
Set the day of the month to the given date.
// CommonJS var setDate = require('date-fns/setDate')
// ES 2015 import setDate from 'date-fns/setDate'
// ESM import { setDate } from 'date-fns'
setDate(date, dayOfMonth)
Name | Description |
---|---|
date |
the date to be changed |
dayOfMonth |
the day of the month of the new date |
Description |
---|
the new date with the day of the month set |
Type | Description |
---|---|
TypeError |
2 arguments required |
// Set the 30th day of the month to 1 September 2014: const result = setDate(new Date(2014, 8, 1), 30) //=> Tue Sep 30 2014 00:00:00
© 2021 Sasha Koss and Lesha Koss
Licensed under the MIT License.
https://date-fns.org/v2.29.2/docs/setDate