mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-08-25 11:06:45 +00:00
27 lines
542 B
JavaScript
27 lines
542 B
JavaScript
/*\
|
|
title: $:/core/modules/macros/view/viewers/date.js
|
|
type: application/javascript
|
|
module-type: fieldviewer
|
|
|
|
A viewer for viewing tiddler fields as a date
|
|
|
|
\*/
|
|
(function(){
|
|
|
|
/*jslint node: true, browser: true */
|
|
/*global $tw: false */
|
|
"use strict";
|
|
|
|
function renderValue(tiddler,field,value,viewMacro) {
|
|
var template = viewMacro.params.template || "DD MMM YYYY";
|
|
if(value === undefined) {
|
|
return $tw.Tree.Text("");
|
|
} else {
|
|
return $tw.Tree.Text($tw.utils.formatDateString(value,template));
|
|
}
|
|
}
|
|
|
|
exports["date"] = renderValue;
|
|
|
|
})();
|