title: How to compare a date to a string in JavaScript?
body: <p>I am currently trying to create a custom filter which will display the latest up to date file in my system. I am using <strong>AngularJS</strong> in order to filter my listed data.</p>
  
  <p>The issue that I am having is that my <strong>date</strong> data is stored as a string in my json file and I am not sure how to filter it so it. </p>
  
  <p>My idea was to create a custom filter by storing today's date as a variable and comparing it to the json file stored date.</p>
  
  <p><strong>Here is how my json file looks</strong>:</p>
  
  <pre><code>{
      "data": [
  
          {
              "title": "Something Exciting",
              "description": "A TV show about something really exciting.",
              "date": " 06/2017",
              "link": "../pdf/whoReadsBooksAnyway.pdf"
          },
          {
              "title":"Stranger Things",
              "description":"Getting back that 80's Steven King Vibe",
              "date": "05/2017",
              "link": "../pdf/AllAlongTheWatchTower.pdf"
          }
      ]
  }
  </code></pre>
  
  <p>I need to display the items by the latest <code>date</code> field, so I started creating a custom filter: </p>
  
  <pre><code> app.filter('dateFilter', function($scope){
  
           $scope.getDatetime = new Date();
  
           var aaa = "../../../views/TvShows/json/shows.json"
           $http.get(aaa).then(function maybe(response, date){
                  $scope.data = reseponse.data.data;
              });
  
          if($scope.getDatetime &lt; $scope.data.date){
              return $scope.myFilter;
          } else{
              console.log("it didn't work");
          }
      });
  </code></pre>
  
  <p>The idea behind the filter is to catch the date with an http request and compare it to <code>$scope.GetDatetime</code> which is the current date. I am not really sure how to build the filter. 
  <code>xstatsx</code> is just a <code>$scope</code> object that I return from my initial http get request.</p>
  
  <pre><code>   var xurlx = '../../../views/TvShows/json/shows.json'
              $http.get(xurlx).then(function(response, data){
                  $scope.xstatsx = response.data.data; 
              });
  </code></pre>
  
  <p>In my HTML I am using this to filter and display only the most recent date:</p>
  
  <pre><code>  &lt;div class="well well-lg" style="display: inline-block;" ng-repeat="n in xstatsx | orderBy: '-date'" ng-show='0 == $index'&gt;
  </code></pre>
  
  <blockquote>
    <p>How can I filter my output so it shows only the latest up to date
    listed files?</p>
  </blockquote>