Forums
How to get current week start and end date from dashboard - Printable Version

+- Forums (https://bdn.bdb.ai)
+-- Forum: BDB Knowledge Base (https://bdn.bdb.ai/forumdisplay.php?fid=13)
+--- Forum: BDB Dashboards Designer (https://bdn.bdb.ai/forumdisplay.php?fid=43)
+---- Forum: BDB Designer Q & A (https://bdn.bdb.ai/forumdisplay.php?fid=16)
+---- Thread: How to get current week start and end date from dashboard (/showthread.php?tid=654)



How to get current week start and end date from dashboard - abhishek_acharya - 12-26-2022

var date = new Date();
var currentWeekDay = date.getDay();
var lessDays = currentWeekDay == 0 ? 6 : currentWeekDay-1;

var weekkStart = new Date(new Date(date).setDate(date.getDate()- lessDays));
var weekkEnd = new Date(new Date(wkStart).setDate(wkStart.getDate()+6));