I have a two sets of data in database one is date and one is time. I display my data in calendar. I made one post request when user choose the date, that time will be selected for the user. I want to make one helper function when user's choosing time will be over I want to show them alert in front-end that "Your selected time expired!". I am using date-fns for date validation.
This is my code so far:
const { isToday } = require("date-fns");
const helperFunction = (date, time) => {
if (isToday(new Date(date))) {
// in here I want to compare to current time and selected time ("15:30-16:30")
}
};
console.log(helperFunction("2021-06-15", "15:30-16:30"));