diff --git a/calendar/base/content/agenda-listbox.js b/calendar/base/content/agenda-listbox.js index 46e80e8dfc..275d9af197 100644 --- a/calendar/base/content/agenda-listbox.js +++ b/calendar/base/content/agenda-listbox.js @@ -6,9 +6,10 @@ Components.utils.import("resource://gre/modules/Services.jsm"); Components.utils.import("resource://gre/modules/Preferences.jsm"); Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); -function Synthetic(aOpen, aDuration) { +function Synthetic(aOpen, aDuration, aMultiday) { this.open = aOpen; this.duration = aDuration; + this.multiday = aMultiday; } var agendaListbox = { @@ -29,11 +30,11 @@ function initAgendaListbox() { var showTodayHeader = (document.getElementById("today-header-hidden").getAttribute("checked") == "true"); var showTomorrowHeader = (document.getElementById("tomorrow-header-hidden").getAttribute("checked") == "true"); var showSoonHeader = (document.getElementById("nextweek-header-hidden").getAttribute("checked") == "true"); - this.today = new Synthetic(showTodayHeader, 1); + this.today = new Synthetic(showTodayHeader, 1, false); this.addPeriodListItem(this.today, "today-header"); - this.tomorrow = new Synthetic(showTomorrowHeader, 1); + this.tomorrow = new Synthetic(showTomorrowHeader, 1, false); this.soonDays = getSoondaysPreference(); - this.soon = new Synthetic(showSoonHeader, this.soonDays); + this.soon = new Synthetic(showSoonHeader, this.soonDays, true); this.periods = [this.today, this.tomorrow, this.soon]; this.mPendingRefreshJobs = new Map(); diff --git a/calendar/base/content/agenda-listbox.xml b/calendar/base/content/agenda-listbox.xml index c6076f9945..dc54624af7 100644 --- a/calendar/base/content/agenda-listbox.xml +++ b/calendar/base/content/agenda-listbox.xml @@ -127,14 +127,14 @@ .getInTimezone(calendarDefaultTimezone()); let endPreviousDay = endDate.clone(); endPreviousDay.day--; - let now = cal.now(); - now.isDate = true; - let longPeriod = periodStartDate.subtractDate(now).days > 1; + // Show items's date for long periods but also for "Upcoming" + // period with one day duration. + let showDate = aPeriod.multiday || aPeriod.duration > 1; let date = ""; let iconType = ""; let allDayDateLabel = document.getAnonymousElementByAttribute(this, "anonid", "agenda-allDayEvent-date"); - setBooleanAttribute(allDayDateLabel, "hidden", !longPeriod); + setBooleanAttribute(allDayDateLabel, "hidden", !showDate); if (startDate.compare(endPreviousDay) != 0) { // All day event spanning multiple days. if (startDate.compare(periodStartDate) >= 0 && @@ -219,9 +219,9 @@ if (endAtMidnight) { endDate.day--; } - let now = cal.now(); - now.isDate = true; - let longFormat = periodStartDate.subtractDate(now).days > 1; + // Show items's date for long periods but also for "Upcoming" + // period with one day duration. + let longFormat = aPeriod.multiday || aPeriod.duration > 1; let duration = ""; let iconType = "";