Fix relative date viewer so that it displays absolute dates in static HTML representations

print-window-tiddler
Jeremy Ruston 2013-03-19 19:06:23 +00:00
rodzic ec83bc5c64
commit 2aff4db744
1 zmienionych plików z 5 dodań i 6 usunięć

Wyświetl plik

@ -20,9 +20,10 @@ var RelativeDateViewer = function(viewWidget,tiddler,field,value) {
};
RelativeDateViewer.prototype.render = function() {
this.relativeDate = undefined;
var template = this.viewWidget.renderer.getAttribute("template","DD MMM YYYY"),
value = "";
if(this.value !== undefined) {
this.relativeDate = $tw.utils.getRelativeDate((new Date()) - this.value);
value = $tw.utils.formatDateString(this.value,template);
}
// Set the element details
this.viewWidget.tag = "span";
@ -31,7 +32,7 @@ RelativeDateViewer.prototype.render = function() {
};
this.viewWidget.children = this.viewWidget.renderer.renderTree.createRenderers(this.viewWidget.renderer.renderContext,[{
type: "text",
text: this.relativeDate ? this.relativeDate.description : ""
text: value
}]);
};
@ -39,9 +40,7 @@ RelativeDateViewer.prototype.render = function() {
Trigger the timer when the relative date is put into the DOM
*/
RelativeDateViewer.prototype.postRenderInDom = function() {
if(this.relativeDate) {
this.update();
}
this.update();
};
/*