From 73142d47401fa4fba97f3c76b85c90d70291429b Mon Sep 17 00:00:00 2001 From: "jminta%gmail.com" Date: Mon, 5 Jun 2006 18:04:06 +0000 Subject: [PATCH] Bug 337848 Only use times for Today and Tomorrow in the agenda view. Patch by richard@duif.net, r=jminta --- calendar/lightning/content/agenda-tree.js | 24 ++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/calendar/lightning/content/agenda-tree.js b/calendar/lightning/content/agenda-tree.js index 54ecaa346d55..97792fee0131 100644 --- a/calendar/lightning/content/agenda-tree.js +++ b/calendar/lightning/content/agenda-tree.js @@ -127,20 +127,34 @@ function setTree(tree) agendaTreeView.getCellText = function getCellText(row, column) { + // title column var event = this.events[row]; if (column.id == "col-agenda-item") { if (event instanceof Synthetic) return event.title; return event.title; } - - if (event instanceof Synthetic) - return ""; - var start = event.startDate || event.dueDate; + // date/time column var dateFormatter = Components.classes["@mozilla.org/calendar/datetime-formatter;1"] .getService(Components.interfaces.calIDateTimeFormatter); + if (event instanceof Synthetic) { + if (event == this.today) { + return dateFormatter.formatDate(this.today.start); + } + else if (event == this.tomorrow) { + return dateFormatter.formatDate(this.tomorrow.start); + } + return ""; + } + var start = event.startDate || event.dueDate; start = start.getInTimezone(calendarDefaultTimezone()); - return dateFormatter.formatDateTime(start); + if (start.compare(this.tomorrow.end) == -1) { + // time only for events on today and tomorrow + return dateFormatter.formatTime(start); + } + else { + return dateFormatter.formatDateTime(start); + } }; agendaTreeView.getLevel =