From 9e7af4281708a24a5ba7f86dbdd8bc662e4b8ab5 Mon Sep 17 00:00:00 2001 From: Gubar Nikita Date: Mon, 12 Feb 2024 16:11:30 +0300 Subject: [PATCH] highlighting an overdue task(ProjectTracker) --- src/pages/ProjectTracker/ProjectTracker.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/pages/ProjectTracker/ProjectTracker.js b/src/pages/ProjectTracker/ProjectTracker.js index 115fb46e..dde739ec 100644 --- a/src/pages/ProjectTracker/ProjectTracker.js +++ b/src/pages/ProjectTracker/ProjectTracker.js @@ -1,3 +1,4 @@ +import moment from "moment"; import React, { useEffect, useRef, useState } from "react"; import { HexColorPicker } from "react-colorful"; import { useDispatch, useSelector } from "react-redux"; @@ -63,6 +64,7 @@ export const ProjectTracker = () => { const dispatch = useDispatch(); const projectId = useParams(); + const currentDate = new Date().getFullYear(); const [openColumnSelect, setOpenColumnSelect] = useState({}); const [selectedTab, setSelectedTab] = useState(0); const [priorityTask, setPriorityTask] = useState(0); @@ -871,6 +873,14 @@ export const ProjectTracker = () => { )}
{column.tasks.map((task) => { + const dateDeadline = new Date(task.dead_line); + const currentDate = moment().format( + "YYYY-MM-DD HH:mm:ss" + ); + const titleColor = + dateDeadline < new Date(currentDate) + ? "red" + : "#1a1919"; return (
{ } }} > -

+

{task.title}