Files
zulip/zephyr/static/js/timerender.js
Reid Barton 59dab21fcd Render recent dates as weekdays, part 1.
This commit just moves time rendering logic to its own file, and does
not make any functionality changes.

(imported from commit d111d03c6abc8d9550fcf65e4f89eab8056d1ed4)
2013-02-19 15:58:25 -05:00

18 lines
565 B
JavaScript

var timerender = (function () {
var exports = {};
// Given an XDate object 'time', return a DOM node that initially
// displays the human-formatted time, and is updated automatically as
// necessary (e.g. changing "Mon 11:21" to "Jan 14 11:21" after a week
// or so).
// (But for now it just returns a static node.)
exports.render_time = function(time) {
// Wrap the text in a span because (oddly) a text node has no outerHTML attribute.
return $("<span />").text(time.toString("MMM dd") + "\xa0\xa0" + time.toString("HH:mm"));
};
return exports;
}());