Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check date is not zero in javascript?

I want to check if date is not equal to 0000-00-00 00:00:00. How can I check it in javascript?

I checked with date !== null but it is not working.

like image 759
Trupti Avatar asked Mar 26 '26 04:03

Trupti


1 Answers

You can check "0000-00-00 00:00:00" with

Date.parse(date) // NaN

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse

like image 87
Julia Avatar answered Mar 27 '26 17:03

Julia



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!