Answers for "how to get total days of month in moment.js"

5

momentjs number of days between two dates

var given = moment("2018-03-10", "YYYY-MM-DD");
var current = moment().startOf('day');

//Difference in number of days
moment.duration(given.diff(current)).asDays();
Posted by: Guest on October-29-2020
1

first day of month and last day of month moment js

const startOfMonth = moment().clone().startOf('month').format('YYYY-MM-DD hh:mm');
const endOfMonth   = moment().clone().endOf('month').format('YYYY-MM-DD hh:mm');
Posted by: Guest on May-20-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language