How to format the date returned by pug template engine rendering

return data to the page

exports.renderProjectList = async (ctx) => {
    let list = await projectDao.list(ctx.state.page.page, ctx.state.page.size)
    await ctx.render("projectList", {
        list: list,
        csrf: ctx.csrf
    })
}

render data:

td= l.createAt

effect is shown in figure

clipboard.png

the project has referenced moment.js,. How do I format the date?

I used the js conversion function in the project, and I also tried moment, but after the conversion was unsuccessful, there was no change, but any date passed in can be successfully converted.

for(let l of list){
        l.createAt =new Date(l.createAt).toLocaleString()
        l.updateAt=new Date(l.updateAt).toLocaleString()
        console.log(l.createAt) //2018-06-05T06:31:49.000Z

    }
Menu