mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
This commit just moves time rendering logic to its own file, and does not make any functionality changes. (imported from commit d111d03c6abc8d9550fcf65e4f89eab8056d1ed4)
18 lines
565 B
JavaScript
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;
|
|
}());
|