Add the specified number of weeks to the given date.
Add the specified number of week to the given date.
// CommonJS
var addWeeks = require('date-fns/addWeeks')
// ES 2015 import addWeeks from 'date-fns/addWeeks'
// ESM
import { addWeeks } from 'date-fns'
addWeeks(date, amount)
| Name | Description |
|---|---|
date |
the date to be changed |
amount |
the amount of weeks to be added. Positive decimals will be rounded using |
| Description |
|---|
|
the new date with the weeks added |
| Type | Description |
|---|---|
TypeError |
2 arguments required |
// Add 4 weeks to 1 September 2014: const result = addWeeks(new Date(2014, 8, 1), 4) //=> Mon Sep 29 2014 00:00:00
© 2021 Sasha Koss and Lesha Koss
Licensed under the MIT License.
https://date-fns.org/v2.29.2/docs/addWeeks