Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

fix(calendarTitle): use start of iso week instead of week for the wee…

…k view title

Closes #557
  • Loading branch information...
Matt Lewis
Matt Lewis committed Mar 18, 2017
1 parent f7949cf commit 357cd28c9568855ebd3e25d26d35bedb170ff6a8
Showing with 5 additions and 1 deletion.
  1. +1 −1 src/services/calendarTitle.js
  2. +4 −0 test/unit/services/calendarTitle.spec.js
@@ -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) {
@@ -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');
});

0 comments on commit 357cd28

Please sign in to comment.
You can’t perform that action at this time.