const date = new Date();
const oneWeekLater = addDaysToDate(date, 7); // also works with negative #s
function addDaysToDate(date: Date, days: number): Date {
return new Date(date.getTime() + daysToMilliseconds(days));
}
function daysToMilliseconds(days: number): number {
// 24 hours, 60 minutes, 60 seconds, 1000 milliseconds
return days * 24 * 60 * 60 * 1000;
}