diff --git a/tools/jslint/check-all.js b/tools/jslint/check-all.js
index e8796cc1ca..f6bccf8d8f 100644
--- a/tools/jslint/check-all.js
+++ b/tools/jslint/check-all.js
@@ -3,7 +3,7 @@
// Global variables, categorized by place of definition.
var globals =
// Third-party libraries
- ' $ jQuery Spinner Handlebars'
+ ' $ jQuery Spinner Handlebars XDate'
// index.html
+ ' initial_pointer email class_list people_list have_initial_messages'
diff --git a/zephyr/jstemplates/zephyr.html b/zephyr/jstemplates/zephyr.html
index f5799c801d..661ce20432 100644
--- a/zephyr/jstemplates/zephyr.html
+++ b/zephyr/jstemplates/zephyr.html
@@ -54,7 +54,7 @@
{{sender_email}}
{{/include_sender}}
- {{timestr}}
+ {{{timestr}}}
{{{content}}}
diff --git a/zephyr/static/js/zephyr.js b/zephyr/static/js/zephyr.js
index 10feee1ea1..74fe9ba314 100644
--- a/zephyr/static/js/zephyr.js
+++ b/zephyr/static/js/zephyr.js
@@ -229,6 +229,27 @@ function clear_table(table_name) {
message_groups[table_name] = [];
}
+function add_display_time(zephyr, prev) {
+ var two_digits = function (x) { return ('0' + x).slice(-2); };
+ var time = new XDate(zephyr.timestamp * 1000);
+ var include_date = zephyr.include_recipient;
+
+ if (prev !== undefined) {
+ var prev_time = new XDate(prev.timestamp * 1000);
+ if (time.toDateString() !== prev_time.toDateString()) {
+ include_date = true;
+ }
+ }
+
+ if (include_date) {
+ zephyr.timestr = time.toString("MMM dd") + " " +
+ time.toString("HH:mm");
+ } else {
+ zephyr.timestr = time.toString("HH:mm");
+ }
+ zephyr.full_date_str = time.toLocaleString();
+}
+
function add_to_table(zephyrs, table_name, filter_function, where) {
if (zephyrs.length === 0)
return;
@@ -291,6 +312,8 @@ function add_to_table(zephyrs, table_name, filter_function, where) {
ids_where_next_is_same_sender.push(prev.id);
}
+ add_display_time(zephyr, prev);
+
zephyr.dom_id = table_name + zephyr.id;
zephyrs_to_render.push(zephyr);
@@ -381,12 +404,6 @@ function add_zephyr_metadata(dummy, zephyr) {
break;
}
- var time = new Date(zephyr.timestamp * 1000);
- var two_digits = function (x) { return ('0' + x).slice(-2); };
- zephyr.timestr = two_digits(time.getHours())
- + ':' + two_digits(time.getMinutes());
- zephyr.full_date_str = time.toLocaleString();
-
zephyr_dict[zephyr.id] = zephyr;
}