Add Days to Date

Add a specified number of days to a date and return the result in ISO format.

Code

General
const date = new Date(dateStr);
date.setDate(date.getDate() + days);
return date.toISOString().split('T')[0];

Parameters

Starting date (YYYY-MM-DD)

Number of days to add

Browser·fetch() may be limited by CORS

More JavaScript Snippets