JSFiddle - React, Tailwind, and code Playground

by evan

JavaScript

var s = '2010-03-30'.split('-');
var d = new Date(s[0], s[1], s[2]);

if (!isNaN(d.getTime())) {
    document.body.style.backgroundColor = "green";
} else {
    document.body.style.backgroundColor = "red";
}