3
I have two variables, startTime (01:00:00 AM) and endTime (02:00:00 AM), need to calculate the difference between one and the other, how would do this at the angle? vi que existe o Date.parse(), but I need to pass a date.
3
I have two variables, startTime (01:00:00 AM) and endTime (02:00:00 AM), need to calculate the difference between one and the other, how would do this at the angle? vi que existe o Date.parse(), but I need to pass a date.
1
Example co filter:
generalFilters.filter('dateDiff', function () {
  var magicNumber = (1000 * 60 * 60 * 24);
  return function (toDate, fromDate) {
    if(toDate && fromDate){
      var dayDiff = Math.floor((toDate - fromDate) / magicNumber);
      if (angular.isNumber(dayDiff)){
        return dayDiff + 1;
      }
    }
  };
});
{{entry.toStr | dateDiff:entry.fromStr}} 
Credits: https://stackoverflow.com/questions/25635082/calculating-date-difference-with-angular-filter
1
See if any of these help you in what you need:
Browser other questions tagged javascript angularjs
You are not signed in. Login or sign up in order to post.
http://momentjs.com/
– DontVoteMeDown