angular minus date

The solution for “angular minus date” can be found here. The following code will assist you in solving the problem.

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;
}

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in