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
.