Find the next 8 dates that are Mondays (exclusive of today)
I think you may have a bug (depends on how the calculation should work). If today is a Sunday, the mondayOffset will be 7 - (0 - 1) == 8, meaning the entire upcoming week will be skipped. In other words, mondayOffset will always be in the range 2-8. I'm guessing that's not what you want.

When dealing with dates, I find it simpler to deal with them as just dates, rather than as millisecond timestamps. Also, with timestamp arithmetic there's always the risk of time zones messing things up for you (for instance when going to/from daylight savings time).

Besides a millisecond number, the Date constructor also accepts separate arguments for year, month, date, hour, etc.. The neat thing is that if you pass a date that doesn't exist, like June 33rd, it'll automatically roll over to July 3rd.

So you can just increment the date argument as needed to produce valid dates in the future:



var app = angular.module("angularApp", []);
app.controller("appController", function($scope, $filter) {
  $scope.mondays = [];

  var today  = new Date(),
      year   = today.getFullYear(),
      month  = today.getMonth(),
      date   = today.getDate(),
      offset = 8 - (today.getDay() || 7); // days till next Monday

  for(var i = 0 ; i &lt; 8 ; i++) {
    $scope.mondays.push( new Date(year, month, date + offset + 7 * i) );
  }
});
body {
  font-family: verdana;
  font-size: 10pt;
}
&lt;script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"&gt;&lt;/script&gt;
&lt;div ng-app="angularApp" ng-controller="appController"&gt;
  &lt;ul&gt;
    &lt;li ng-repeat="date in mondays track by $index"&gt;{{date | date}}&lt;/li&gt;
  &lt;/ul&gt;
&lt;/div&gt;




Here the offset will be in the range 1-7, so if today's a Sunday, it'll only skip 1 day ahead.