How to get next week start and end using moment.js?

Sometimes, we want to get next week start and end using moment.js.

In this article, we’ll look at how to get next week start and end using moment.js.

How to get next week start and end using moment.js?

To get next week start and end using moment.js, we can sue the add, startOf, and endOf methods.

For instance, we write:

const startNextWeek = moment().add(1, 'weeks').startOf('isoWeek')
const endNextWeek = moment().add(1, 'weeks').endOf('isoWeek')

console.log(startNextWeek)
console.log(endNextWeek)

to get the current date time with moment.

Then we call add with 1 and 'weeks' to add 1 week to the current date and time.

And then we call startOf and endOf with 'isoWeek' to get the start and end of next week respectively.

isoWeek starts Monday and ends Sunday.

Conclusion

To get next week start and end using moment.js, we can sue the add, startOf, and endOf methods.