I am trying to convert a date string of the format dd.MM.yyyy
to a Date object. I have tried the following :
if( typeof myVar === 'string') {
let myDate = new Date(myVar);
if (myDate.getTime() < this.getMinDate().getTime()) /** compare two dates */
//omitted source code
}
this.getMinDate().getTime()
reads 1612989937059
while myDate.getTime()
reads NaN
. I have tried other date format patterns such as dd-MM-yyyy
and dd/MM/yyyy
. None of them seems to work either.