Currently, I am working on a project in Angular that involves allowing employees to record their work hours. However, I am facing a challenge in figuring out how to gather all the work dates and store them in an array. Here is what I have attempted so far:
getDaysInMonth(month, year) {
this.date = new Date(Date.UTC(year, month,));
this.days = [];
while (this.date.getMonth() === month) {
if(this.date.getDay() == 6 || this.date.getDay() == 0) {
return "weekend";
}
this.days.push(new Date(this.date));
this.date.setDate(this.date.getDate() + 1);
}
return this.days;
}