Forum Academy Marketplace Showcase Pricing Features

API to validate a date

Does anyone know of an API or JS library to validate dates? Thanks!

Have you tried something like this?

I’m currently trying to make this work. I’m not sure what you mean by validade, but the above js works based on utc time (milliseconds since Jan 1, 1970) to determine months.

I believe the poster is asking if a date given in some format (probably text) is valid date. E.g. 02/30/2056 would return false because there are only 28 days in February.

Scott, yes, that’s exactly right…

Moment.js is great for this, and not hard to implement.

https://momentjs.com/docs/#/parsing/is-valid/

There are Node.js libraries to do it, so you could create a little webtask.io API for yourself.