I have the following string value of a date, Sun Apr 07 2019 00:00:00 GMT-0300
, and I need to compare with the following date form
Convert all the values to Date
objects and compare those. Use a framework/library to do it, because parsing strings to dates manually has lots of places where it can go wrong.
Currently you are comparing the literal String
s. Because neither "2019-04-08T03:00:00.000Z"
, nor "2019-04-13T03:00:00.000Z"
match "Sun Apr 07 2019 00:00:00 GMT-0300 (Horário Padrão de Brasília)"
, your second if
statement fails.