Using the getDay method of Date objects, you can know the number of day of the week (being 0=Sunday, 1=Monday, etc).

You can then subtract that number of days plus one, for example:

function getMonday(d) {
  d = new Date(d);
  var day = d.getDay(),
    diff = d.getDate() - day + (day == 0 ? -6 : 1); // adjust when day is sunday
  return new Date(d.setDate(diff));
}

console.log( getMonday(new Date()) ); // e.g. Mon Nov 08 2010

Answer from Christian C. Salvadó on Stack Overflow
🌐
W3Resource
w3resource.com › javascript-exercises › javascript-date-exercise-50.php
JavaScript: Get the week start date - w3resource
July 17, 2025 - ... // Define a function startOfWeek that takes a Date object date as input function startOfWeek(date) { // Calculate the difference between the date's day of the month and its day of the week var diff = date.getDate() - date.getDay() + (date.getDay() === 0 ?...
🌐
Day.js
day.js.org › docs › en › get-set › weekday
Day of Week (Locale Aware) · Day.js
dayjs.extend(weekday) // when Sunday is the first day of the week dayjs().weekday(-7); // last Sunday dayjs().weekday(7); // next Sunday // when Monday is the first day of the week dayjs().weekday(-7) // last Monday dayjs().weekday(7) // next Monday // when Sunday is the first day of the week dayjs().weekday(-5) // last Tuesday (5th day before Sunday) dayjs().weekday(5) // next Friday (5th day after Sunday)
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › getDay
Date.prototype.getDay() - JavaScript - MDN Web Docs
const birthday = new Date("August 19, 1975 23:15:30"); const day1 = birthday.getDay(); // Sunday - Saturday : 0 - 6 console.log(day1); // Expected output: 2 ... An integer, between 0 and 6, representing the day of the week for the given date according to local time: 0 for Sunday, 1 for Monday, ...
🌐
W3Schools
w3schools.com › jsref › jsref_getday.asp
JavaScript Date getDay() Method
const weekday = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]; const d = new Date(); let day = weekday[d.getDay()]; Try it Yourself » ... If you want to use W3Schools services as an educational institution, team or ...
🌐
JavaScript in Plain English
javascript.plainenglish.io › how-to-get-the-first-day-of-the-week-from-the-current-date-with-javascript-7743ad44fafd
How to Get the First Day of the Week from the Current Date with JavaScript? | by John Au-Yeung | JavaScript in Plain English
July 31, 2021 - Then we get the difference between the current date of the week and the Monday of the same week by subtracting the day and then add -6 back if day is 0 and 1 otherwise. ... New JavaScript and Web Development content every day.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Intl › Locale › getWeekInfo
Intl.Locale.prototype.getWeekInfo() - JavaScript | MDN
For example, in the ISO 8601 calendar, the first week of a year must have at least 4 days in this year, so if January 1 is a Friday, Saturday, or Sunday, it will be numbered as part of the last week of the previous year. Return the week information for a given Locale. ... const he = new Intl.Locale("he"); // Hebrew (Israel) console.log(he.getWeekInfo()); // { firstDay: 7, weekend: [5, 6], minimalDays: 1 } const af = new Intl.Locale("af"); // Afrikaans (South Africa) console.log(af.getWeekInfo()); // { firstDay: 7, weekend: [6, 7], minimalDays: 1 } const enGB = new Intl.Locale("en-GB"); // Engl
🌐
Bobby Hadz
bobbyhadz.com › blog › javascript-get-first-and-last-day-of-current-week
Get First and Last Day of the current Week in JavaScript | bobbyhadz
March 5, 2024 - ... Copied!const today = new Date(); // ✅ Get the first day of the current week (Monday) function getFirstDayOfWeek(d) { // 👇️ clone date object, so we don't mutate it const date = new Date(d); const day = date.getDay(); // 👉️ get ...
Find elsewhere
🌐
GitHub
gist.github.com › markthiessen › 3883242
JavaScript - get weeks in a month as array of start and end days · GitHub
This one will allow you to start from any day of the week. function endFirstWeek(firstDate, firstDay) { if (! firstDay) { return 7 - firstDate.getDay(); } if (firstDate.getDay() < firstDay) { return firstDay - firstDate.getDay(); } else { return 7 - firstDate.getDay() + firstDay; } } function getWeeksStartAndEndInMonth(month, year, start) { let weeks = [], firstDate = new Date(year, month, 1), lastDate = new Date(year, month + 1, 0), numDays = lastDate.getDate(); let start = 1; let end = endFirstWeek(firstDate, 2); while (start <= numDays) { weeks.push({start: start, end: end}); start = end + 1; end = end + 7; end = start === 1 && end === 8 ?
🌐
GitHub
github.com › gamtiq › weekstart
GitHub - gamtiq/weekstart: Library to get first day of week.
define(['path/to/dist/full.js'], function(weekstart) { const getWeekStartByLocale = weekstart.getWeekStartByLocale; const getWeekStartByRegion = weekstart.getWeekStartByRegion; }); <!-- Use bower_components/weekstart/dist/main.js and bower_components/weekstart/dist/full.js if the library was installed by Bower --> <script type="text/javascript" src="path/to/dist/main.js"></script> <script type="text/javascript"> // weekstart is available via weekstart field of window object const getWeekStartByLocale = weekstart.getWeekStartByLocale; const getWeekStartByRegion = weekstart.getWeekStartByRegion; </script>
Starred by 21 users
Forked by 6 users
Languages   JavaScript 100.0% | JavaScript 100.0%
🌐
Ellie
ellie.wtf › notes › get-week-start-javascript
Get the first day of the week with JavaScript
June 18, 2024 - I’m currently building a calendar data display for Atuin, and wanted to ensure that the week started with the correct day. While I’m a big fan of things being configurable and flexible, I don’t want to introduce a new config option unless it’s required! Luckily browser localisation exposes plenty of options. ... let locale = new Intl.Locale(navigator.language); let weekinfo = locale.getWeekInfo(); console.log(weekinfo.firstDay); // prints 1 for me, in the UK · Docs here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getWeekInfo
🌐
Day.js
day.js.org › docs › en › get-set › day
Day of Week · Day.js
Accepts numbers from 0 (Sunday) to 6 (Saturday). If the range is exceeded, it will bubble up to other weeks. dayjs().day() // gets day of current week dayjs().day(0) // returns new dayjs object
🌐
Blogger
lifelongprogrammer.blogspot.com › 2014 › 06 › js-get-first-last-day-of-current-week-month.html
Programmer: Lifelong Learning: JavaScript: Get the First and Last day of Current Week and Month
June 10, 2014 - The basic idea is to use getDate() and getDay(), and get the difference of current date and the first or last day of this week.
🌐
Educative
educative.io › answers › how-to-get-day-of-the-week-in-javascript-using-getday
How to get day of the week in JavaScript using getDay()
The getDay() returns a value within the range of zero to six, a zero-based numbering. The value returned represents a day of the week. Hence, 0 represents Sunday, 1 represents Monday, and so on. First, we create an array of the days of the week:
🌐
Webdevtutor
webdevtutor.net › blog › javascript-date-get-first-day-of-week
How to Get the First Day of the Week in JavaScript
You can now use the getFirstDayOfWeek() function to retrieve the first day of the week for any date in JavaScript.
🌐
TutorialsPoint
tutorialspoint.com › How-to-get-the-day-of-the-week-in-JavaScript
How to get the day of the week in JavaScript?
August 26, 2022 - Use the JavaScript getDay() method to determine the day of the week.
🌐
SPGuides
spguides.com › get-first-and-last-day-of-week-in-typescript
How to Get First and Last Day of Week in Typescript?
November 15, 2023 - TypeScript provides multiple ways to get the first day of the week from a given date. Whether using native JavaScript methods or libraries like Moment.js or Day.js.