Moment JS Get All Dates in Month Example

By Hardik Savani | January 13, 2021 | Category : jQuery


I am going to explain you example of moment get all dates in month. step by step explain how to get all dates in a month in moment js. you will learn jquery moment get dates in month. This article will give you simple example of get all dates in month moment js.

Here, i will give you simple example of jquery moment js get all dates in a month.

let's see both example with output:


<!DOCTYPE html>



<title>jquery moment example -</title>

<script src="" crossorigin="anonymous"></script>

<script src="" crossorigin="anonymous"></script>



<h1>jquery moment example -</h1>


<script type="text/javascript">

var getDaysOfMonth = function(year, month) {

var monthDate = moment(year+'-'+month, 'YYYY-MM');

var daysInMonth = monthDate.daysInMonth();

var arrDays = [];

while(daysInMonth) {

var current = moment().date(daysInMonth);




return arrDays;


var dateList = getDaysOfMonth(2021, 01);





0: "01-31-2021"

1: "01-30-2021"

2: "01-29-2021"

3: "01-28-2021"

4: "01-27-2021"

5: "01-26-2021"

6: "01-25-2021"

7: "01-24-2021"

8: "01-23-2021"

9: "01-22-2021"

10: "01-21-2021"

11: "01-20-2021"


26: "01-05-2021"

27: "01-04-2021"

28: "01-03-2021"

29: "01-02-2021"

30: "01-01-2021"

I hope it can help you...

Tags : jQuery Moment JS

Hardik Savani
My name is Hardik Savani. I'm a full-stack developer, entrepreneur and owner of Aatman Infotech. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.
Follow Me: Github Twitter
***Do you want me hire for your Project Work? Then Contact US.

We are Recommending you: