зеркало из https://github.com/mozilla/pjs.git
Bug 266241: use system time format in the views. patch by ssiter, r=mvl
This commit is contained in:
Родитель
c639cd1bcb
Коммит
a93b1379f6
|
@ -67,18 +67,15 @@
|
|||
<setter><![CDATA[
|
||||
this.mOccurrence = val;
|
||||
|
||||
function formatTime(aTime) {
|
||||
var m = aTime.minute;
|
||||
return (aTime.hour + ":" + (m < 10 ? "0" : "") + m);
|
||||
}
|
||||
|
||||
var str = null;
|
||||
// if val is an event and not an all day event, show start time in title
|
||||
if (val instanceof Components.interfaces.calIEvent && !val.startDate.isDate) {
|
||||
str = formatTime(val.startDate.getInTimezone(this.calendarView.mTimezone))
|
||||
var df = Components.classes["@mozilla.org/calendar/datetime-formatter;1"]
|
||||
.getService(Components.interfaces.calIDateTimeFormatter);
|
||||
str = df.formatTime(val.startDate.getInTimezone(this.calendarView.mTimezone));
|
||||
} else if (val instanceof Components.interfaces.calITodo) {
|
||||
// yeah, this should really be a little picture instead of a "*"
|
||||
str = "* "
|
||||
str = "* ";
|
||||
} else {
|
||||
str = " ";
|
||||
}
|
||||
|
|
|
@ -149,6 +149,9 @@
|
|||
while (topbox.lastChild)
|
||||
topbox.removeChild(topbox.lastChild);
|
||||
|
||||
var formatter = Components.classes["@mozilla.org/intl/scriptabledateformat;1"]
|
||||
.getService(nsIScriptableDateFormat);
|
||||
var timeString;
|
||||
var theMin = this.mStartMin;
|
||||
var theHour = Math.floor(theMin / 60);
|
||||
var durLeft = this.mEndMin - this.mStartMin;
|
||||
|
@ -167,7 +170,10 @@
|
|||
if (dur != 60) {
|
||||
box = makeTimeBox("", dur * this.mPixPerMin);
|
||||
} else {
|
||||
box = makeTimeBox(String(theHour) + ":00", dur * this.mPixPerMin);
|
||||
timeString = formatter.FormatTime("",
|
||||
nsIScriptableDateFormat.timeFormatNoSeconds,
|
||||
theHour, 0, 0);
|
||||
box = makeTimeBox(timeString, dur * this.mPixPerMin);
|
||||
}
|
||||
|
||||
box.setAttribute("class", "calendar-time-bar-box-" + (theHour % 2 == 0 ? "even" : "odd"));
|
||||
|
@ -1172,8 +1178,17 @@
|
|||
var endhr = Math.floor(realendmin / 60);
|
||||
var endmin = realendmin % 60;
|
||||
|
||||
this.fgboxes.startlabel.setAttribute("value", starthr + ":" + (startmin < 10 ? "0" : "") + startmin);
|
||||
this.fgboxes.endlabel.setAttribute("value", endhr + ":" + (endmin < 10 ? "0" : "") + endmin);
|
||||
var formatter = Components.classes["@mozilla.org/intl/scriptabledateformat;1"]
|
||||
.getService(nsIScriptableDateFormat);
|
||||
var startstr = formatter.FormatTime("",
|
||||
nsIScriptableDateFormat.timeFormatNoSeconds,
|
||||
starthr, startmin, 0);
|
||||
var endstr = formatter.FormatTime("",
|
||||
nsIScriptableDateFormat.timeFormatNoSeconds,
|
||||
endhr, endmin, 0);
|
||||
|
||||
this.fgboxes.startlabel.setAttribute("value", startstr);
|
||||
this.fgboxes.endlabel.setAttribute("value", endstr);
|
||||
|
||||
]]></body>
|
||||
</method>
|
||||
|
|
Загрузка…
Ссылка в новой задаче