1

I want to show the transaction history on my project. But I want to show like transaction was 2m ago or 2h ago. For this reason how can I calculate and control this date calculation.

The variable came like dd/mm/yyy hh:mm:ss

I want to show like after calculation 1m 1d

Atakan
  • 97
  • 10

1 Answers1

0

I would recommend moment.js to you moment.js docs - difference

const date1 = moment('2016-10-08 10:29:23');
const date2 = moment('2016-10-08 11:06:55');
const diff = date2.diff(date1);
const minutesDif= date2.diff(date1, 'minutes');

for your exact application i would recommend a look into the documentation

J1n
  • 71
  • 5