Javascript 如何为可编辑日期设置正确的日期格式

Javascript 如何为可编辑日期设置正确的日期格式,javascript,angularjs,date,x-editable,node-postgres,Javascript,Angularjs,Date,X Editable,Node Postgres,我从postgres获得一些日期文件,格式如下: “2000-11-30T14:00:00.000Z” 我无法在第页的“可编辑日期”字段中使用此选项。比如: <a href="#" editable-date="employee.brthday" onbeforesave="updateField($data, 'brthday', employee)"> {{employee.brthday || 'empty' | date:"dd/MM/yyyy"

我从postgres获得一些日期文件,格式如下:

“2000-11-30T14:00:00.000Z”

我无法在第页的“可编辑日期”字段中使用此选项。比如:

 <a href="#" editable-date="employee.brthday"
     onbeforesave="updateField($data, 'brthday', employee)">
         {{employee.brthday || 'empty' | date:"dd/MM/yyyy" }}
 </a>

此日期(如上所示)显示良好。但当我想要编辑此字段时,日期将重置,我在控制台中收到以下消息:

Error: [ngModel:datefmt] Expected `2000-12-05T14:00:00.000Z` to be a date http://errors.angularjs.org/1.3.0/ngModel/datefmt?p0=2000-12-05T14%3A00%3A00.000Z
    at http://localhost:8000/bower_components/angular/angular.js:80:12
    at Array.<anonymous> (http://localhost:8000/bower_components/angular/angular.js:19453:17)
    at Object.ngModelWatch (http://localhost:8000/bower_components/angular/angular.js:20555:36)
    at Scope.$digest (http://localhost:8000/bower_components/angular/angular.js:13957:40)
    at Scope.$apply (http://localhost:8000/bower_components/angular/angular.js:14227:24)
    at HTMLAnchorElement.<anonymous> (http://localhost:8000/bower_components/angular-xeditable/dist/js/xeditable.js:831:21)
    at HTMLAnchorElement.jQuery.event.dispatch (http://localhost:8000/bower_components/jquery/dist/jquery.js:4409:9)
    at HTMLAnchorElement.elemData.handle (http://localhost:8000/bower_components/jquery/dist/jquery.js:4095:28)
错误:[ngModel:datefmt]预期'2000-12-05T14:00:00.000Z'为日期http://errors.angularjs.org/1.3.0/ngModel/datefmt?p0=2000-12-05T14%3A00%3A00.000Z
在http://localhost:8000/bower_components/angular/angular.js:80:12
在阵列上。(http://localhost:8000/bower_components/angular/angular.js:19453:17)
在Object.ngmodelswatch(http://localhost:8000/bower_components/angular/angular.js:20555:36)
在范围内。$摘要(http://localhost:8000/bower_components/angular/angular.js:13957:40)
在范围内。$apply(http://localhost:8000/bower_components/angular/angular.js:14227:24)
在兰开夏。(http://localhost:8000/bower_components/angular-xeditable/dist/js/xeditable.js:831:21)
在htmlanchorement.jQuery.event.dispatch(http://localhost:8000/bower_components/jquery/dist/jquery.js:4409:9)
在htmlanchorement.elemData.handle(http://localhost:8000/bower_components/jquery/dist/jquery.js:4095:28)
如果我只是通过编辑字段(输入新日期)来更新模型,它在将来可能会被很好地编辑,因为存储的日期类似于(date obj?):

2000年12月6日星期三00:00:00 GMT+1000

如何将输入日期转换为角度格式?
我还尝试用“新日期(此处输入日期)”替换输入日期格式,但它不起作用。可能是输入日期格式无法仅从字符串解析?


总结:我需要将输入日期格式转换为date obj或通过pg.js日期字段(如日期对象)获取。我怎样才能从中做点什么呢?

Postgres正在以ISO 8601格式存储日期,Javascript
Date
可以对其进行开箱即用的解析,例如:

var x = new Date("2000-11-30T14:00:00.000Z");
console.log(x);

2000年11月30日星期四06:00:00 GMT-0800(太平洋标准时间)中的结果符合我的时区。

我找到了一个答案。。。我试图在服务器端将输入日期转换为dateobj,然后将json发送到客户端。在客户机上,我总是将日期作为字符串,而不是日期对象。当我在客户端执行新日期(inputDate)时,一切都正常