I have two date fields the first one is store in MSSQL database known as leavingDate the second is a date picker in the form where user have to select a date.
I need to make sure the selectedDate is not greater than the leavingDate but nothing seems to work.
I have formatted both dates to string and comparing them as follows:
leavingDate = '2023/11/30
selectedDate = '2023/12/29 //This is wrong
if(selectedDate > leavingDate)
{
//do something because the date selected is greater.
}
Some of the selected dates works some don’t so how do I make sure that the JS always works when comparing two dates (one from database and one from input fields using moment.js)