Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Commit

Permalink
style(datepicker): improve readability of week loop
Browse files Browse the repository at this point in the history
- Remove extra beforeEach in test
  • Loading branch information
chrisirhc committed Apr 26, 2015
1 parent 39e5fd3 commit 0de8c86
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/datepicker/datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,11 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
if ( scope.showWeeks ) {
scope.weekNumbers = [];
var thursdayIndex = (4 + 7 - ctrl.startingDay) % 7,
curWeek = 0,
numWeeks = scope.rows.length;
while( curWeek < numWeeks ) {scope.weekNumbers.push(getISO8601WeekNumber( scope.rows[curWeek++][thursdayIndex].date ));}
for (var curWeek = 0; curWeek < numWeeks; curWeek++) {
scope.weekNumbers.push(
getISO8601WeekNumber( scope.rows[curWeek][thursdayIndex].date ));
}
}
};

Expand Down
3 changes: 0 additions & 3 deletions src/datepicker/test/datepicker.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2070,9 +2070,6 @@ describe('datepicker directive', function () {
});

describe('first week in january', function() {
beforeEach(inject(function() {
}));

it('in current year', function() {
$rootScope.date = new Date('January 07, 2014');
element = $compile('<datepicker ng-model="date"></datepicker>')($rootScope);
Expand Down

0 comments on commit 0de8c86

Please sign in to comment.