Format edit times properly

The "Last edited:" time should match the post time (12 hour format, with
exceptions).

(imported from commit 13d981da2945cecd3f287da0e4200c32b3921682)
This commit is contained in:
Scott Feeney 2013-08-23 13:55:23 -04:00
parent 439e984f3d
commit d0be30ab08
1 changed files with 10 additions and 6 deletions

View File

@ -15,6 +15,13 @@ function MessageListView(list, table_name, collapse_messages) {
(function () {
function stringify_time(time) {
if (feature_flags.twenty_four_hour_time) {
return time.toString('HH:mm');
}
return time.toString('h:mmtt');
}
function add_display_time(message, prev) {
var time = new XDate(message.timestamp * 1000);
var include_date = false;
@ -37,11 +44,8 @@ function add_display_time(message, prev) {
message.show_date = undefined;
}
if (message.timestr === undefined){
message.timestr = time.toString("h:mmtt");
if (feature_flags.twenty_four_hour_time) {
message.timestr = time.toString("HH:mm");
}
if (message.timestr === undefined) {
message.timestr = stringify_time(time);
}
}
@ -239,7 +243,7 @@ MessageListView.prototype = {
var last_edit_time = new XDate(message.last_edit_timestamp * 1000);
message.last_edit_timestr =
(timerender.render_date(last_edit_time))[0].outerHTML
+ " " + last_edit_time.toString("HH:mm");
+ " " + stringify_time(last_edit_time);
}
message.dom_id = table_name + message.id;