moment object to date code example
Example 1: moment to date
moment().toDate();
Example 2: format a date moment
moment(testDate).format('MM/DD/YYYY');
Example 3: moment date add
var new_date = moment(startdate, "DD-MM-YYYY").add(5, 'days');
Example 4: moment to javascript date
let now = moment()
let now = now.toDate()
Example 5: moment get day
var check = moment(n.entry.date_entered, 'YYYY/MM/DD');
var month = check.format('M');
var day = check.format('D');
var year = check.format('YYYY');
Example 6: moment.js format
moment("20111031", "YYYYMMDD").fromNow(); // 9 years ago
moment("20120620", "YYYYMMDD").fromNow(); // 8 years ago
moment().startOf('day').fromNow(); // 13 hours ago
moment().endOf('day').fromNow(); // in 11 hours
moment().startOf('hour').fromNow(); // 4 minutes ago