I have two date string in ISO format. I am calculating the minutes difference between them using moment js.
var currenttime = new Date().toISOString();
var expiretime = '2020-06-05T12:18:33.000Z';
let minutes = moment(expiretime, 'YYYY-MM-DD[T]HH:mm:ss. SSS[Z]').diff(moment(currenttime, 'YYYY-MM-DD[T]HH:mm:ss. SSS[Z]'), 'minutes');
console.log(minutes)
Now i have two questions
Is this is the best way to calculate the minutes difference ?
When i run
new Date().toISOString()the value beforezis the supposed to be the timezone but on every restart it changes ?
Please let me know what is the issue ?