title: Detect SQL min date string in javascript
body: <p>In an angularJS application I'm working on, we are using a SQL server to provide data. Nothing odd there. I am tasked with working on the date sanitation, so objects that are passed into our application that have the SQL min date value are undefined, and ones that do have a date are javascript Date objects.</p>
  
  <p>I know that during upgrades, sometimes the string that is defined for min date can change. Right now, it is 0001-01-01T00:00:00Z.  I cannot just do a string comparison because it could change.</p>
  
  <p>My problem is, how do i determine this min date in javascript?  new Date(varThatIsMinDate) is a valid date.  MomentJS thinks its valid too, and it is technically a valid date.  I'm less worried about validation and more worried about "is it min date"</p>
  
  <p>How do you determine min date === true from a zulu pattern 0001-01-01T00:00:00Z or similar in javascript?</p>
  
  <p>My code so far, cause I know you are gonna ask for it:</p>
  
  <pre><code>if (response.config.responseType === 'json')        {
        for (var property in response.data) {
          if (response.data.hasOwnProperty(property)) {
  
            if (property.toUpperCase().indexOf('DATE') &gt; -1 || property.toUpperCase().indexOf('TIME') &gt; -1) {
              console.log(property.toUpperCase());
              // Attempt to use JS built in date and validate
              var tmpDate = new Date(response.data[property]);
              if ($moment(tmpDate).isValid()) {
                // Make it a valid date object if it has a valid date
                response.data[property] = tmpDate;
              } else {
                // Make it undefined
                response.data[property] = undefined;
              }
            }
          }
        }
      }
  </code></pre>
  
  <p>Thing is, its always valid, so this code doesn't work.</p>
  
  <p>EDIT: I could cheat and use tmpDate.getUTCFullYear() === 1 but i'd like to know how to do this the right way.</p>