function getStartOfDay(date = new Date()) {
return new Date(date.setHours(0, 0, 0, 0));
}
function getEndOfDay(date = new Date()) {
return new Date(date.setHours(23, 59, 59, 999));
}
console.log(getStartOfDay(new Date()));
console.log(getEndOfDay(new Date()));
/*
run:
2025-12-12T00:00:00.000Z
2025-12-12T23:59:59.999Z
*/