DEV Community

Discussion on: I build date and range picker from scratch so you don't have to

Collapse
 
pothureddypalli profile image
Pothureddypalli • Edited

Hi am very new to this Date Range Picker and am done Date Range Picker in Type script showing single month but I need to show two months, Please help me in building the calendar showing two months

This is the code I had done to show calendar for one month but I need two months to show please help me .

public createCalender(month) {
const firstDay = moment(month).startOf('M');
const days = Array.apply(null, {length: month.daysInMonth()})
.map(Number.call, Number)
.map((n) => {
return moment(firstDay).add(n, 'd');
});
for (let n = 0; n < firstDay.weekday(); n++) {
days.unshift(null);
}
return days;
}