【发布时间】:2017-03-25 09:57:55
【问题描述】:
我似乎无法在我的 keystone JS 博客和其他页面上设置日期格式。
如果我在模板中使用 {{ publishedDate }}(我正在使用车把)一切都很好,只是它给了我这样的信息:Thu Mar 23 2017 00:00:00 GMT+0000(GMT 标准时间)这显然不好。
{{ post.publishedDate.format('D MMMM') }}
{{ post._.publishedDate.format('D MMMM') }}
{{ publishedDate.format('D MMMM') }}
全部返回错误如下: 第 18 行的解析错误: ... post.publishedDate.format('D MMMM') }}
我也尝试过更改模型中的内容:
publishedDate: { type: Types.Date, index: true, format: 'YYYY', dependsOn: { state: 'published' }},
及其众多变体。我查看了位于 http://keystonejs.com/docs/database/#fieldtypes-date 的 keystone 文档,并尝试实现其中所说的内容,但仍然无法正常工作。
这实际上应该很简单,我敢肯定 - 我只是不知道该怎么做(!)
任何帮助表示赞赏。
【问题讨论】:
标签: javascript date format keystonejs