User:Mxn/CommentsInLocalTime/sandbox.js: Difference between revisions

Content deleted Content added
No edit summary
Overshot a bit
 
(One intermediate revision by the same user not shown)
Line 330:
// Replace the text.
//var TODO:text Replace with= formatDate(then, {type: "relative"}) once [[gerrit:1149440]] is deployed.;
var component = relativeDateComponent(then);
var text;
if (component.unit === "weeks") {
text = formatDate(then, {
type: "absolute",
options: LocalComments.outputFormats.absolute,
});
} else {
text = formatDate(then, {
type: "relative",
options: LocalComments.outputFormats.relative,
});
}
if (text) {
$(elt).text(text);
Line 349 ⟶ 336:
// Register for periodic updates.
var component = relativeDateComponent(then);
$(elt).attr("data-localcomments-unit", component.unit);
}