Moment.min.js this.format 不是函数

Moment.min.js this.format is not a funtion

我正在尝试在 xeditable 中使用 combodate 但是,当我尝试保存时 moment.min.js 说 this.format 不是一个函数。这是来自 moment.js 的某个地方所以这是我的代码:

$('#start').editable({
  viewformat: 'DD-MM-YYYY',
  success: function(result, newValue){
    return $.ajax({
      url: '/Project/Edit',
      data: { id: '1', NewValue: newValue, type: 'StartDate' },
      success: function (result) {
        if (result.Success == 'Success') {
          notify('The Start Date was successfully updated.', 'success');
        } else {
          notify('The Start Date could not be updated at this time.', 'error');
        }
      }
    });
  }
}).on('hidden', function () { 
  $(this).parent().next().children().removeClass('disabled');
});

这是在 moment.js

中调用的行
toString: function () { return this.format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")

moment.js 中的这一行在调用可编辑成功函数后立即调用。

我明白了。我不得不在 ajax 调用中对 newValue 调用 .format() 方法。这就是 js 给我那个错误的时刻。这是工作代码:

$('#start').editable({
  viewformat: 'DD-MM-YYYY',
  success: function(result, newValue){
    return $.ajax({
      url: '/Project/Edit',
      data: { id: '1', NewValue: newValue.format('MM/DD/YYYY'), type: 'StartDate' },
      success: function (result) {
        if (result.Success == 'Success') {
          notify('The Start Date was successfully updated.', 'success');
        } else {
          notify('The Start Date could not be updated at this time.', 'error');
        }
      }
    });
  }
}).on('hidden', function () { 
  $(this).parent().next().children().removeClass('disabled');
});