I have an interface from the BE like this:
export interface DailyGoal extends Base {
date: Date;
percentage: number;
}
Now I’m trying to refer to that in my component.ts file
import { DailyGoal } from '../../interfaces';
dailyGoal: DailyGoal[] = [];
But I don’t understand how to push the variable that I have into the date and percentage.
I created this function that will give me the list of days that the user may choose
(I still need to figure it out how to do the percentage)
getDays(startDate: Date, endDate: Date) {
const dates = [];
const percentage = [];
const currentDate = startDate;
while (currentDate < endDate) {
dates.push(new Date(currentDate));
currentDate.setDate(currentDate.getDate() + 1);
}
// for (let date of dates) {
// if (date.getDay() <= 5) {
// percentage.push(100);
//
// } else date.getDay() > 5;
// percentage.push(0);
if (startDate && endDate) dates.push(endDate);
return dates;
}
how can I push my “date” variable into the interface?
hope you can help me, thank you so much