0

I've migrated to Day.js from Moment.js and can't find the solution to display the difference in dates with units. For example, I have two dates: '2021-02-01' and '2021-02-04' and I need to get exactly 3 days (using my locale). In addition, I also want to add one day here - this is my working code in Moment.js:

const a = moment(endDate);
const b = moment(startDate);

moment.duration(a.diff(b)).add(1, 'days').humanize();

As I see humanize() works only with duration in Day.js, how can I have desired output?

Vadim
  • 59
  • 1
  • 6
  • Please take look :https://stackoverflow.com/questions/56472567/how-to-calculate-the-elapsed-days-between-two-dates – abhay Feb 19 '21 at 09:06
  • Thanks, I know how to get difference in dates. My question is how to get difference together with units. – Vadim Feb 19 '21 at 13:52

0 Answers0