当使用max和min方法比较两个MomentJS对象时,我遇到了一个奇怪的结果.它们似乎返回错误的值.
例如,此代码今天而不是明天返回:
moment().max(moment().add(1, 'd'))
谁能解释这种行为?
最佳答案 在查看MomentJS 2.2.1的源代码之后,这里是max()的源代码:
max: function ( other ) {
other = moment.apply( null, arguments );
return other > this ? this : other;
},
好像他们正在返回这个,当其他人稍后..很奇怪..