TypeError: someDate.getTime is not a function

I encounter this error when using my app on device even though it works just fine in browser, what might be the reason of that?
someDate is a date object to clarify

Show some code, how did you declare someDate?

public someDate: Date = new Date();

then in other place:

console.log(Math.floor(this.settingsService.someDate.getTime() / 60000) * 60000);

and error:

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

I have found the answer but I forget to write it here, it was happening like this, because the way a date object is stored in mobile phone is different than in PC.

1 Like

how did you fix it? i have the same problem.

1 Like