Comparison between two dates

I want to compare two dates the date of today and the date enters by the form
post as Sun Jan 31 1999 16:00:00 GMT-0800 (PST)
I wrote the following code but it shows me nothing

if (Moment(“createdAt”).isAfter Moment(“dateexp”)){

alert(“le produit expremer”);}
alert(“le produit n’est pas exprimer”);

It seems you are using Moment.js. Did you read .isAfter() documentation ?

You try to create date with invalid strings (“createdAt” and “dateexp”), look how it is done in the documentation.

1 Like

i looked but i still don’t know whay date with strings (“createdAt” and “dateexp”) is invalid