title: Moment.js formatting outputs as 'invalid date'
body: <p>I have a formatTime function using moment.js
  but if the number comes in as NaN moment.js outputs as 'invalid date'</p>
  
  <p>how can i fix this?</p>
  
  <pre><code>$scope.formatTime = function(time) {
  
      if (time&gt;24){
          time-=24;
      }
      return moment({
          hour: Math.floor(time),
          minute: time - Math.floor(time) * 60
      }).format('h:mm a');
  };
  </code></pre>