const Moment = require('moment'); const MomentRange = require('moment-range'); const moment = MomentRange.extendMoment(Moment); (()=>{ const month = moment('2022-10', 'YYYY-MM'); const range = moment().range(moment(month).startOf('month'), moment(month).endOf('month')); const days = range.by('days'); let datearr = [...days].map(element=>element.format('DD-MM-YYYY')); console.log(datearr); })()