Respect locale in time format of attendees window

This commit is contained in:
Francis Lachapelle committed 2013-12-18 22:18:08 -05:00
1 parent 7369a82bab
commit 1f7994d1bf
4 files changed
+28 -7

No files matched your search

@@ -14,6 +14,31 @@ String.prototype.formatted = function() {
return newString;
};
String.prototype.formatTime = function(hours, minutes) {
var newString = this;
// See http://www.gnustep.org/resources/documentation/Developer/Base/Reference/NSCalendarDate.html#method$NSCalendarDate-descriptionWithCalendarFormat$
var p = 'am', i = hours, m = minutes;
if (hours > 12) {
p = 'pm';
i = hours % 12;
}
if (minutes < 10) {
m = '0' + minutes;
}
// %H : hour as a decimal number using 24-hour clock
newString = newString.replace("%H", hours < 10 ? '0' + hours : hours);
// %I : hour as a decimal number using 12-hour clock
newString = newString.replace("%I", i < 10 ? '0' + i : i);
// %M : minute as decimal number
newString = newString.replace("%M", m);
// %p : 'am' or 'pm'
newString = newString.replace("%p", p);
return newString;
};
String.prototype.repeat = function(count) {
var newString = "";
for (var i = 0; i < count; i++) {
+1 -7
View File
@@ -1453,14 +1453,8 @@ function prepareTableHeaders() {
rows[0].appendChild(header1b);
for (var hour = displayStartHour; hour < (displayEndHour + 1); hour++) {
var header2 = document.createElement("th");
var text = hour + ":00";
if (hour < 10)
text = "0" + text;
if (hour >= dayStartHour && hour < dayEndHour)
$(header2).addClassName ("officeHour");
header2.appendChild(document.createTextNode(text));
header2.appendChild(document.createTextNode(timeFormat.formatTime(hour, 0)));
rows[1].appendChild(header2);
var header3 = document.createElement("th");
for (var span = 0; span < 4; span++) {
var spanElement = document.createElement("span");