In my application, the user should be able to submit a date and time, then I need to compare the date/time with the current date (I need to check if the date/time submitted from the user has passed, or for example, if it will pass within 24H). In my html file, I have:
<input type="datetime-local" id="dateInput" />
And in my Javascript file, I am calling it as such:
var dateValue = document.getElementById("dateInput").value;
I'd like to compare dateValue with the current date/time (for example by using dateValue > Date.now() ), however, they are in different formats. For example, the log from console
console.log('Comparing ', dateValue, " with " , Date.now() )
Returns:
Comparing 2019-06-12T19:30 with 1552409011189
Without using external libraries, how can I convert dateValue in Unix time so that I can compare it to Date.now() ?