'How to get the value of date parameter to compare it with today date from a object of values taken from backend as a object in react useEffect?

I took data from backend and I want to take one value from that data object and do calculations using that value.

const[scheduleData,setScheduleData] = React.useState();
    


    useEffect(() => {
        api.get('api/schedule')
        .then((res) => {
          //  console.log(res.data);
            setScheduleData(res.data.data);
           console.log(res.data.data.data);
        })
        .catch((err) =>{
           // console.log("error")
        })
    })

There is a value called date is in this data object. I want to take that value and compare it with today and want to print whether is it expired or not.


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source