Skip to content
This repository has been archived by the owner on Jun 19, 2018. It is now read-only.

Commit

Permalink
fix(calendarTitle): use start of iso week instead of week for the wee…
Browse files Browse the repository at this point in the history
…k view title

Closes #557
  • Loading branch information
Matt Lewis committed Mar 18, 2017
1 parent f7949cf commit 357cd28
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/services/calendarTitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ angular
function week(viewDate) {
return calendarConfig.titleFormats.week
.replace('{week}', moment(viewDate).isoWeek())
.replace('{year}', moment(viewDate).startOf('week').format('YYYY'));
.replace('{year}', moment(viewDate).startOf('isoweek').format('YYYY'));
}

function month(viewDate) {
Expand Down
4 changes: 4 additions & 0 deletions test/unit/services/calendarTitle.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ describe('calendarTitle', function() {
expect(calendarTitle.week(new Date('2016-01-01'))).to.equal('Week 53 of 2015');
});

it('should use the start of the iso week for the year number', function() {
expect(calendarTitle.week(new Date('2018-01-01'))).to.equal('Week 1 of 2018');
});

it('should give the correct month title', function() {
expect(calendarTitle.month(calendarDay)).to.equal('May 2015');
});
Expand Down

0 comments on commit 357cd28

Please sign in to comment.