JSFiddle - React, Tailwind, and code Playground
by bvotcode
JavaScript
function isMondayOfCurrentWeek(date = new Date()) {
const today = new Date();
const first = today.getDate() - today.getDay() + 1;
const monday = new Date(today.setDate(first));
return monday.toDateString() === date.toDateString();
}
var time_now = 'Wed Feb 22 2023 06:38:02 GMT+0700'
var time_now_convert = new Date(time_now)
var time_now_format = time_now_convert.getDay()
console.log(time_now_format)
//var check_weekend = isMondayOfCurrentWeek(time_now)
//console.log(check_weekend)