Question: how to calculate number of days between two dates using moment.js?
Answer: var dateofvisit = moment('{visit}', 'DD-MM-YYYY'); var today = moment(); today. diff(dateofvisit, 'days'); In this calculation '{visit}' is the variable name of the date of the visit.