Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Getting previous month first day and future month last day using moment.js
const prevMonthFirstDay = moment().subtract(1, 'months').date(1);

const nextMonthLastDay = moment().add(2, 'months').date(0);

or

const prevMonthFirstDay = moment().subtract(1, 'months').startOf('month');

const nextMonthLastDay = moment().add(1, 'months').endOf('month');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.