我正在尝试更改由moment.js设置的日期语言.默认一个是英语,但我想用德语.这些是我试过的:
var now = moment().format("LLL").lang("de");
Run Code Online (Sandbox Code Playgroud)
给予NAN,没有用.
var now = moment("de").format("LLL");
Run Code Online (Sandbox Code Playgroud)
甚至没有反应,也没有起作用.
var now = moment().format("LLL", "de");
Run Code Online (Sandbox Code Playgroud)
没有变化,仍然英语,没有工作.
这怎么可能?
我从我的数据中获得了ISO格式的日期以及我实际想要做的是直接从我的模板修改我的日期格式.
像这样:
{{format my.context.date "myFormat"}}
Run Code Online (Sandbox Code Playgroud)
我正在使用时刻库,所以我可以这样写:
{{formatDate my.context.date "DD.MM.YYYY HH:mm"}} // 03.09.2013 18:12
Run Code Online (Sandbox Code Playgroud)
这会很好,因为我认为这是我应该能够做到这一点的地方.在我的模板中.