Start of Week

Get the start of the week for a date.

Code

General
const d = new Date(date);
const day = d.getDay();
d.setDate(d.getDate() - day);
return d.toISOString().split('T')[0];

Parameters

Input date

Browser·fetch() may be limited by CORS

More JavaScript Snippets