In this tutorial, We will learn how to momentjs get all dates in a month. 

Lets learn by example:

        <title>jquery moment example</title>
        <script src="" crossorigin="anonymous"></script>
        <script src="" crossorigin="anonymous"></script>
        <h1>jquery moment example get months</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;

        ////it wil return array of dates
        var dateList = getDaysOfMonth(2021, 1);

Now, You have understood what is movementjs to get all dates. Run your application enjoy the code.

Thanks, May this example will help you...