I have a date in the format as "16-Jun-2015" and I need to compare it to today's date to see it is not larger.
Since my input date is a string I first converted to a date object:
new Date("16-Jun-2015");
Then I took this to compare to today's date:
if(date.compare(new Date("16-Jun-2015"), new Date()) > 0){
//Do stuff if input is larger than today's date
}
The new Date("16-Jun-2015") returns the value 'Invalid date.' How can I compare these dates? I also cannot use any third-party Date libraries, as I do not own the entire codebase I'm working with.
The duplicate question message is incorrect as that question only displays parsing, but not comparing.