How to check if date is Monday in TypeScript

1 Answer

0 votes
function isMonday(date = new Date()) {
  	return date.getDay() === 1;
}


console.log(isMonday(new Date('2022-03-9'))); 
console.log(isMonday(new Date('2022-03-14'))); 


  
  
  
  
/*
run:
  
false
true
  
*/

 



answered Mar 10, 2022 by avibootz

Related questions

1 answer 281 views
1 answer 282 views
1 answer 239 views
1 answer 213 views
213 views asked Mar 24, 2022 by avibootz
1 answer 210 views
210 views asked Mar 24, 2022 by avibootz
1 answer 275 views
1 answer 282 views
...