JS compares two simple sample code for time sizes

  • 2020-03-30 00:59:51
  • OfStack

As follows:

if (new Date(strSD.replace(/-/g, '/')) > new Date(strED.replace(/-/g, '/'))) { //The start time is greater than the end time
                alert(" Wrong timing! The start date must be less than or equal to the end period! ");
                return false;
}

Related articles: