I am really pulling my hair now and going crazy:
const {year, month} = req.headers;
const date_range_from = new Date(year, month, 1);
const date_range_to = new Date(year, month + 1, 1); // wrong year; why?
console.log("year, month: ", year, month)
console.log("date_range_from, date_range_to: ", date_range_from, date_range_to)
The console log gives:
year, month: 2021 6
date_range_from, date_range_to: 2021-06-30T15:00:00.000Z 2026-01-31T15:00:00.000Z
WHY 2026 ???? What is going on???