mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-25 17:40:29 +00:00
Deal with viewing date fields that don't exist
This commit is contained in:
parent
cc4940f41f
commit
ea0b298b78
@ -80,7 +80,11 @@ ViewWidget.prototype.getValueAsText = function() {
|
|||||||
// Calling getTiddlerText() triggers lazy loading of skinny tiddlers
|
// Calling getTiddlerText() triggers lazy loading of skinny tiddlers
|
||||||
text = this.wiki.getTiddlerText(this.viewTitle);
|
text = this.wiki.getTiddlerText(this.viewTitle);
|
||||||
} else {
|
} else {
|
||||||
text = tiddler.fields[this.viewField];
|
if($tw.utils.hop(tiddler.fields,this.viewField)) {
|
||||||
|
text = tiddler.fields[this.viewField];
|
||||||
|
} else {
|
||||||
|
text = "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else { // Use a special value if the tiddler is missing
|
} else { // Use a special value if the tiddler is missing
|
||||||
switch(this.viewField) {
|
switch(this.viewField) {
|
||||||
@ -112,8 +116,12 @@ ViewWidget.prototype.getValueAsDate = function(format) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
ViewWidget.prototype.getValueAsRelativeDate = function(format) {
|
ViewWidget.prototype.getValueAsRelativeDate = function(format) {
|
||||||
var d = new Date(this.getValueAsText());
|
var value = this.getValueAsText();
|
||||||
return $tw.utils.getRelativeDate((new Date()) - d).description;
|
if(value) {
|
||||||
|
return $tw.utils.getRelativeDate((new Date()) - (new Date(value))).description;
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user