I am trying to validate text as valid date, but i am getting wrong answers
I tried libraries like moments and date-fns , the text is free so it can be for example : 'eer 05/03/2345', for this text js Date object creates a valid date .
code examples :
var t=moment('43/05/2020','dd/MM/yyyy'); console.log(t.isValid()) //returns true should be false
var t=moment('03/05/2020','dd/MM/yyyy',true); console.log(t.isValid()) //returns false should be true
//using date-fns
console.log(format(new Date('ssds 3/3/2020'), 'dd/MM/yyyy')); //returns true should be false