Categories
JavaScript Answers

How to fix JavaScript getTime() is not a function error?

Spread the love

Sometimes, we want to fix JavaScript getTime() is not a function error.

In this article, we’ll look at how to fix JavaScript getTime() is not a function error.

How to fix JavaScript getTime() is not a function error?

To fix JavaScript getTime() is not a function error, we should make sure we’re calling getTime on date objects.

For instance, we write

const res = new Date(dat1).getTime() > new Date(dat2).getTime();

so that we’re calling getTime on 2 date objects to compare their timestamps.

Conclusion

To fix JavaScript getTime() is not a function error, we should make sure we’re calling getTime on date objects.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published.