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 - -6 : 1); // Set the date to the ... ... The function "startOfWeek()" takes a "Date" object 'date' as input. It calculates the difference between the day of the month ('date.getDate()') and the day of the week ('date.getDay()'). If the day of the week is Sunday (0), it adjusts the difference to ensure the start of the week is considered Monday...
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › getDay
Date.prototype.getDay() - JavaScript - MDN Web Docs - Mozilla
The weekday variable has value 1, based on the value of the Date object xmas95, because December 25, 1995 is a Monday. ... const xmas95 = new Date("1995-12-25T23:15:30"); const weekday = xmas95.getDay(); console.log(weekday); // 1
🌐
Medium
medium.com › @quynh.totuan › how-to-get-the-current-week-in-javascript-9e64d45a9a08
How to Get the Current Week in Javascript | by Quynh Nhu To Tuan | Medium
August 29, 2017 - What we need to do is get the day of the month, find out the weekday (Tuesday, Wednesday, etc), subtract the number needed to get to Monday, and then create the new date using the new calculated day and combine it with the current month. We are going to make use of Javascript’s built in methods: new Date, getDate, getDay, and setDate.
🌐
W3Schools
w3schools.com › jsref › jsref_getday.asp
JavaScript Date getDay() Method
The getDay() method returns the day of the week (0 to 6) of a date. Sunday = 0, Monday = 1, ...
🌐
{app_name}/
camkode.com › posts › get-monday-and-sunday-of-the-week-in-javascript
Get Monday and Sunday of the Week in JavaScript - Camkode
const today = new Date() const ... the day of the week for the specified date according to local time: 0 for Sunday, 1 for Monday, 2 for Tuesday, and so on....
Find elsewhere
🌐
Experts Exchange
experts-exchange.com › questions › 28155045 › getting-the-date-of-monday-and-sunday-of-the-current-week.html
Solved: getting the date of monday and sunday of the current week | Experts Exchange
July 12, 2013 - ... Log in or create a free account to see answer. Signing up is free and takes 30 seconds. No credit card required. ... function getMonday(d) { d = new Date(d); var day = d.getDay(), diff = d.getDate() - day + (day == 0 ?
Top answer
1 of 9
31

You can get the previous Monday by getting the Monday of this week and subtracting 7 days. The Sunday will be one day before that, so:

var d = new Date();

// set to Monday of this week
d.setDate(d.getDate() - (d.getDay() + 6) % 7);

// set to previous Monday
d.setDate(d.getDate() - 7);

// create new date of day before
var sunday = new Date(d.getFullYear(), d.getMonth(), d.getDate() - 1);

For 2012-12-03 I get:

Mon 26 Nov 2012
Sun 25 Nov 2012

Is that what you want?

// Or new date for the following Sunday
var sunday = new Date(d.getFullYear(), d.getMonth(), d.getDate() + 6);

which gives

Sun 02 Dec 2012

In general, you can manipulate date objects by add and subtracting years, months and days. The object will handle negative values automatically, e.g.

var d = new Date(2012,11,0)

Will create a date for 2012-11-30 (noting that months are zero based so 11 is December). Also:

d.setMonth(d.getMonth() - 1); // 2012-10-30

d.setDate(d.getDate() - 30);  // 2012-09-30
2 of 9
7

if you dont want to do it with an external library you should work with timestamps. i created a solution where you would substract 60*60*24*7*1000 (which is 604800000, which is 1 week in milliseconds) from the current Date and go from there:

var beforeOneWeek = new Date(new Date().getTime() - 60 * 60 * 24 * 7 * 1000)
  , day = beforeOneWeek.getDay()
  , diffToMonday = beforeOneWeek.getDate() - day + (day === 0 ? -6 : 1)
  , lastMonday = new Date(beforeOneWeek.setDate(diffToMonday))
  , lastSunday = new Date(beforeOneWeek.setDate(diffToMonday + 6));
🌐
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 day ...
🌐
Javatpoint
javatpoint.com › calculate-current-week-number-in-javascript
Calculate current week number in JavaScript - javatpoint
September 29, 2020 - Calculate current week number in JavaScript with javascript tutorial, introduction, javascript oops, application of javascript, loop, variable, objects, map, typedarray etc.
🌐
TutorialsPoint
tutorialspoint.com › javascript › date_getday.htm
JavaScript Date getDay() Method
<html> <body> <script> function isWeekend() { const currentDate = new Date('2023-12-23'); const dayOfWeek = currentDate.getDay(); if (dayOfWeek === 0 || dayOfWeek === 6) { document.write("It's the weekend"); } else { document.write("It's a weekday."); } } isWeekend(); </script> </body> </html> The above program prints "It's the weekend" because the day of the week for the specified date is 6.
🌐
GitHub
gist.github.com › dblock › 1081513
get week of the year in JavaScript · GitHub
* * e.g. 2014/12/29 is Monday in week 1 of 2015 * 2012/1/1 is Sunday in week 52 of 2011 */ function getWeekNumber(d) { // Copy date so don't modify original d = new Date(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate())); // Set to nearest Thursday: current date + 4 - current day number // Make Sunday's day number 7 d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay()||7)); // Get first day of year var yearStart = new Date(Date.UTC(d.getUTCFullYear(),0,1)); // Calculate full weeks to nearest Thursday var weekNo = Math.ceil(( ( (d - yearStart) / 86400000) + 1)/7); // Return array of year and week number return [d.getUTCFullYear(), weekNo]; }
🌐
Day.js
day.js.org › docs › en › get-set › weekday
Day of Week (Locale Aware) · Day.js
Gets or sets the day of the week according to the locale. ... If the locale assigns Sunday as the first day of the week, dayjs().weekday(0) will be Sunday. If Monday is the first day of the week, dayjs().weekday(0) will be Monday.
🌐
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 - In the function, create a Date instance with the Date constructor. Then we call getDay to get the day of the week. It returns 0 for Sunday, 1 for Monday, and so on up to 6 for Saturday.
Top answer
1 of 2
3

Here's some snippet of code adapted for a similar question I saw some time ago (can't remember the exact source, it was about getting monday of current week)

Date.prototype.getNextWeekMonday = function() {
    var d = new Date(this.getTime());
    var diff = d.getDate() - d.getDay() + 1;
    if (d.getDay() == 0)
        diff -= 7;
    diff += 7; // ugly hack to get next monday instead of current one
    return new Date(d.setDate(diff));
};

Date.prototype.getNextWeekFriday = function() {
    var d = this.getNextWeekMonday();
    return new Date(d.setDate(d.getDate() + 4));
};

// You can then use it like this :

var date = new Date();
alert(date.getNextWeekMonday());
alert(date.getNextWeekFriday());

It should be tested on touchy days (sunday and monday) to ensure it returns the mondays and fridays from correct week.

2 of 2
0

This just adds an element to HTML, but we can also have a text field where a user can give a desired date, process that input in via event handling and display NextMonday.

<html>
<head><title>DATE EXAMPLE</title></head>
<body>
<div id="date">

</div>
<script type="text/javascript">
    var date = new Date("12/10/2014");
    var divElement = document.getElementById("date");
    divElement.appendChild(document.createTextNode(""));
    var nextMonday = new Date(date.getMonth() + "/" + parseInt(date.getDate() + 7 - date.getDay() + 1) + "/"+ date.getFullYear());
    var newDate = new Date
    divElement.firstChild.nodeValue = nextMonday;
</script>
</body>
</html>

getting NextFriday can be done in similar approach.

🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › getUTCDay
Date.prototype.getUTCDay() - JavaScript | MDN - Mozilla
July 10, 2025 - const date1 = new Date("August ... An integer corresponding to the day of the week for the given date according to universal time: 0 for Sunday, 1 for Monday, 2 for Tuesday, and so on....