Quantcast
Viewing latest article 30
Browse Latest Browse All 58

Answer by Yusef Mohamadi for Detecting an "invalid date" Date instance in JavaScript

you can check the valid format of txDate.value with this scirpt. if it was in incorrect format the Date obejct not instanced and return null to dt .

 var dt = new Date(txtDate.value)
 if (isNaN(dt))

And as @MiF's suggested in short way

 if(isNaN(new Date(...)))

Viewing latest article 30
Browse Latest Browse All 58

Trending Articles