Categories
JavaScript Answers

How to fix .day() returns wrong day of month with Moment.js and JavaScript?

Spread the love

Sometimes, we want to fix .day() returns wrong day of month with Moment.js and JavaScript.

In this article, we’ll look at how to fix .day() returns wrong day of month with Moment.js and JavaScript.

How to fix .day() returns wrong day of month with Moment.js and JavaScript?

To fix .day() returns wrong day of month with Moment.js and JavaScript, we should use the date method instead of day.

For instance, we write

const today = moment().date();

to call date to return the day of the month of today.

Conclusion

To fix .day() returns wrong day of month with Moment.js and JavaScript, we should use the date method instead of day.

Leave a Reply

Your email address will not be published.

If you like the content of this blog, subscribe to my email list to get exclusive articles not available to anyone else.