title: How to filter json data by date range in javascript
body: <p>I want to filter the below json data by start date and end date, it should return the data between start date and end date, I tried to achieve using below code but I'm doing wrong something to filter. I'm new to front end technologies like Javascript and jquery, it would be appreciated if Someone can correct me what I'm doing wrong here:</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;Test&lt;/title&gt;
  
      &lt;/head&gt;
  
      &lt;body&gt;
  
          &lt;script type="text/javascript"&gt;
              var product_data = [
                  {
                      "productId": "12",
                      "productName": "ProductA",
                      "productPrice": "1562",
                      "ProductDateCreated": "2015-07-24T12:58:17.430Z",
                      "TotalProduct": 294
                  },
                  {
                      "productId": "13",
                      "productName": "ProductB",
                      "productPrice": "8545",
                      "TotalProduct": 294,
                      "ProductHits": {
                          "2015-08-01T00:00:00Z"
                      }
                  },
                  {
                      "productId": "14",
                      "productName": "ProductC",
                      "productPrice": "8654",
                      "TotalProduct": 78,
                      "ProductHits": {
                          "2015-08-10T00:00:00Z"
                      }
                  },
                  {
                      "productId": "15",
                      "productName": "ProductD",
                      "productPrice": "87456",
                      "TotalProduct": 878,
                      "ProductHits": {
                          "2015-05-12T00:00:00Z"
                      }
                  }
              ];
  
              var startDate = "2015-08-04";
              var endDate = "2015-08-12";
  
              var resultProductData = product_data.filter(
                      function (a)
                      {
                          return (a.ProductHits) &gt; startDate &amp;&amp; (a.ProductHits) &lt; endDate;
                      });
              console.log(resultProductData);
          &lt;/script&gt;
  
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>