我是TypeScript和AngularJS的新手,我正在尝试从我的API转换日期,例如:
"8/22/2015"
Run Code Online (Sandbox Code Playgroud)
...到ISO日期.正确地将日期反序列化为类型的TypeScript属性Date.但是,当我尝试以下命令时(在typescript中,并且this.dateDisplay是string类型)
this.dateDisplay = formats.dateTimeValue.toISOString();
Run Code Online (Sandbox Code Playgroud)
我收到错误:
TypeError:formats.dateTimeValue.toISOString不是dataFormatsTests.js中的函数:42在processQueue(angular.js:14567)处为angular.js:14583 at Scope.$ get.Scope.$ eval(angular.js:15846)at范围.$ get.Scope.$ digest(angular.js:15657)在Scope.$ get.Scope.$ apply(angular.js:15951)at done(angular.js:10364)at completeRequest(angular.js:10536) )在XMLHttpRequest.requestLoaded(angular.js:10477)
我也去过这个网站,它说我的浏览器支持这个toISOString功能.
所以,我的问题是:为什么我的浏览器,或角度,或其他什么不能识别toISOString功能?