Moment JS Get Current Week Start and End Date Example

In this tutorial, you will learn moment js get current week start and end date. it’s simple example of how to get start date and end date of current week in moment. This article goes in detailed on how to get start date and end date of current week in jquery. This article goes in detailed on get start and end date of current week moment.

Here, i will give you simple example of jquery moment js get current week start and end date using startOf() and endOf().

let’s see both example with output:

Example:

<!DOCTYPE html>

<html>

<head>

<title>jquery moment example - ItSolutionStuff.com</title>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js" crossorigin="anonymous"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js" crossorigin="anonymous"></script>

</head>

<body>

<h1>jquery moment example - ItSolutionStuff.com</h1>

</body>

<script type="text/javascript">

var startDate = moment().startOf('week');

var endDate = moment().endOf('week');

console.log('Start Date:' + startDate.format('MM/DD/YYYY'));

console.log('End Date:' + endDate.format('MM/DD/YYYY'));

</script>

</html>

Output:

Start Date:01/10/2021

End Date:01/16/2021

I hope it can help you…

Leave a Comment