I have the following data set. I have an array of objects like this
[{
createdAt: Wed Feb 08 2017 12:16:35 GMT+0500 (Pakistan Standard Time),
set: 'jr',
},{
createdAt: Wed Feb 08 2017 12:18:36 GMT+0500 (Pakistan Standard Time),
or: 'd',
},{
createdAt: Wed Feb 08 2017 12:22:46 GMT+0500 (Pakistan Standard Time),
or: 'd',
},]
I want to calculate the time difference between each createdAt
, for example from 1st two createdAt
fields it will give '2 minutes'.