Skip to content

Commit

Permalink
Bug 796684 - Cleanup _updateHeader show year in months day view.
Browse files Browse the repository at this point in the history
  • Loading branch information
lightsofapollo committed Oct 4, 2012
1 parent 70d10f6 commit f9dae43
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
18 changes: 6 additions & 12 deletions apps/calendar/js/views/months_day.js
Expand Up @@ -36,18 +36,12 @@ Calendar.ns('Views').MonthsDay = (function() {
},

_updateHeader: function() {
var date = this.date;

var l10n = navigator.mozL10n;

var dayName = l10n.get('weekday-' + date.getDay() + '-long');
var monthName = l10n.get('month-' + date.getMonth() + '-long');

dayName = dayName || date.toLocaleFormat('%A');
monthName = monthName || date.toLocaleFormat('%B');

var header = dayName + ' ' + monthName + ' ' + date.getDate();
this.header.textContent = header;
// maybe we should localize this output ?
var format = this.app.dateFormat.localeFormat(
this.date,
'%A %B %Y'
);
this.header.textContent = format;
},

handleEvent: function(e) {
Expand Down
10 changes: 5 additions & 5 deletions apps/calendar/test/unit/views/months_day_test.js
Expand Up @@ -93,12 +93,12 @@ suite('views/months_day', function() {
subject.date = date;
subject._updateHeader();

var month = date.toLocaleFormat('%B');
var day = date.toLocaleFormat('%A');
var expected = date.toLocaleFormat(
'%A %B %Y'
);

assert.include(el.innerHTML, '11');
assert.include(el.innerHTML, month);
assert.include(el.innerHTML, day);
assert.ok(el.innerHTML, 'has contents');
assert.include(el.innerHTML, expected);
});

test('#header', function() {
Expand Down

0 comments on commit f9dae43

Please sign in to comment.