koa2 + koa-art-template conduit date stamp template will be implemented in jat Date Time Switch

var sp = require("silly-datetime");
var render = require("koa-art-template");
var path = require("path");
var koa = require("koa");

var app = new koa();
render(app,{
    root:path.join(__dirname,"views"),
    extname:'.jat',
    debug:progress.env.NODE_ENV != 'production',
    dateFormat:dateFormat=(value)=>{
       return sp.format(new Date(value),'YYYY-MM-DD HH:mm');
    }
});

Use the template in jat

{{each list}} <- ! found in the database list is an array of data -> 
     {{$ value.datetime | the dateFormat}}! <- list array is a timestamp datetime, shown the dateFormat -> 

{{/}} each

Guess you like

Origin www.cnblogs.com/Liqian-Front-End-Engineer/p/12036557.html