Hi I need to validate two date time moment instances, Using this Package to get time we can select hour min sec in this. I need validate if selected Date time is after or before like you see in code .I'm having confusion will it validate date with time ? How to compare selected date time hour min sec in isAfter/isBefore
function DateValidate(selectedDate,type){ //selected date in moment instance
let isValid=false
const {startTime,endTime}=dateTime // from state
if(type==='start'&& endTime){
isValid=selectedDate.isAfter(endTime);
}else if(type==='end'&& startTime){
isValid=selectedDate.isBefore(startTime);
}
return isValid
}
should i need to format selected date needed format -(dd/mm/yyyy hh:mm:ss) and then apply isBefore/isafter ? Please help...