无法使用时刻生成的 unix 时间戳初始化时刻实例(无效日期)

Cannot initialize a moment instance with a unix timestamp generated from moment (Invalid date)

我对这两个代码示例感到困惑

假设我们有一个从 moment

生成的 Unix 时间戳
moment().format('x');

Result: 1441721685361

代码片段 1

moment(1441721685361);

Result: moment object with date Tue Sep 08 2015 15:14:45 GMT+0100 (BST)

代码片段 2

moment(moment().format('x'));

Result: Invalid date

如果 moment().format('x') returns 一个整数为什么我不能在 moment() 中使用它?

moment().format('x') returns string, but expect number 如果传递时间戳,可以将字符串转换为数字(添加 + 之前或使用 Number(string) ) 并传递给时刻,像这样

console.log(typeof moment().format('x'));
console.log(moment(+moment().format('x')));
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.js"></script>