enltr xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/terms/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:og="http://ogp.me/ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:sioc="http://rdfs.org/sioc/ns#" xmlns:sioct="http://rdfs.org/sioc/types#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#"http://www.w3.org/1999/xhtml/vocab/////////////////Compare dates using .datescompare() | BitsyCodehttps://www.bitsycode.com/methods/manipulation/dates-compareCompare dates using .datescompare() | BitsyCode Compare dates using .datescompare() | BitsyCode html not-front not-logged-in no-sidebars page-node page-node- page-node-14 node-type-page

Compare dates using .datescompare()

container

.datescompare()


Description: Compare dates to each other.


Example:

<!doctype html>
    <html lang="en">
    <head>
      <meta charset="utf-8">
      <title>datescompare demo</title>
      <script src="http://code.bitsycode.com/bitsycode-latest.min.js"></script>
    </head>
    <body>
        
        <div class="row">
            <b>Date 1:</b><br />
            <input type="text" name="example_date_1" class="example_date_1" value="" />
        </div>
        
        <div class="row">
            <b>Date 2:</b><br />
            <input type="text" name="example_date_2" class="example_date_2" value="" />
        </div>
        
        <div class="row">
            <b>Result:</b><br />
            <span class="results"></span>
        </div>
        
        <div class="row">
            <input type="button" name="submit" onclick="validate();" value="Compare" />
        </div>
        
    <script>
        
        function validate() {
            var results = bitsyCode.datescompare(bitsyCode(".example_date_1").val(), bitsyCode(".example_date_2").val());
            var object = "";
            for (var key in results) {
                object += "&nbsp;&nbsp;"+key + " = " + results[key] + "<br />";
            }
            
            var response = "Comparing: <b>" + bitsyCode(".example_date_1").val() + "</b> ";
                response+= "to <b>" + bitsyCode(".example_date_2").val() + "</b><br /><br />{<br />" + object + "}";
            bitsyCode(".results").html(response);
        }
        
    </script>
     
    </body>
    </html>

Preview:

Date 1:

Date 2:

Result:

Share

Developed and built with passion and commitment.
Maintained by the bitsycode team.