我在设备上使用我的应用程序时遇到此错误,即使它在浏览器中工作正常,可能是背后的原因是什么?
public someDate: Date = new Date();
然后在其他地方:
console.log(Math.floor(this.settingsService.someDate.getTime() / 60000) * 60000);
和错误:
TypeError: this.settingsService.someDate.getTime is not a function
at Promise (main.js:26956)
at new t (polyfills.js:3)
at Data.initialPing (main.js:26949)
at TrackerPage.startWork (main.js:39881)
at Object.eval [as handleEvent] (TrackerPage.html:21)
at handleEvent (main.js:12340)
at callWithDebugContext (main.js:13632)
at Object.debugHandleEvent [as handleEvent] (main.js:13220)
at dispatchEvent (main.js:9240)
at main.js:9832
答案 0 :(得分:0)
好的我找到了答案,它在浏览器中工作的原因是移动设备在其内存中以不同的方式存储日期:
2017-08-07T10:26:06.564Z