diff --git a/src/views/Dashboard/DashboardProject.js b/src/views/Dashboard/DashboardProject.js index 74a55cb..2c82a21 100644 --- a/src/views/Dashboard/DashboardProject.js +++ b/src/views/Dashboard/DashboardProject.js @@ -281,8 +281,11 @@ const DashboardProject = () => { setEstAtCompletion(result.data.data[0].data.budget_control.estimated_at_completion?.toString()) setCostDeviation(result.data.data[0].data.budget_control.cost_deviation?.toString()) } + let now = new Date().toISOString().slice(0, 10); + let dates = result.data.data[0].data?.date; + let n = dates.findIndex(element => new Date(now) < new Date(element[0])) - 1; if (result.data.data.length > 0 && result.data.data[0].data?.percentagePlan && result.data.data[0].data?.percentagePlan.length > 0) { - planningProgress = result.data.data[0].data?.percentagePlan[result.data.data[0].data?.percentagePlan.length - 1]; + planningProgress = result.data.data[0].data?.percentagePlan[n]; setPlanningProgress(planningProgress); } if (result.data.data.length > 0 && result.data.data[0].data?.percentageReal && result.data.data[0].data?.percentageReal.length > 0) {