Start of Month

Get the first day of the month for a date.

Code

General
const date = new Date(dateStr);
return new Date(date.getFullYear(), date.getMonth(), 1).toISOString().split('T')[0];

Parameters

Date string

Browser·fetch() may be limited by CORS

More JavaScript Snippets