MomentJs 给出错误的月份

MomentJs gives wrong month

Momentjs 给出了错误的月份。

const time = moment("2300","hhmm").format("HH:mm");
const weekDay = moment().weekday(2).format("DD/MM/YYYY");
const notification =  moment(weekDay + " " + time, "DD/HH/YYYY HH:mm");
console.log(notification);

给予:

Object
_a: [2018, 0, 30, 23, 0, 0, 0] (7)
_d: Tue Jan 30 2018 23:00:00 GMT+0200 (EET)
_f: "DD/HH/YYYY HH:mm"
_i: "30/10/2018 23:00"
_isUTC: false
_l: undefined

不正确应该是 2018 年 10 月 30 日星期二 23:00:00 GMT_0200 (EET)

我不明白为什么会出现一月月份。

Moment version: ^2.1.0

您的解析格式似乎有误。

const notification = moment(weekDay + " " + time, "DD/HH/YYYY HH:mm");

应该是

const notification = moment(weekDay + " " + time, "DD/MM/YYYY HH:mm");