'moment.js - diff in minutes returns incorrect value
I have two variable populated with datetime - one containing value from cookie (utc), the otherone containing current time in utc:
var expiration = moment(Date.parse($.cookie("ecookie")));
var current = moment().utc();
console.log(current.format('MMMM Do YYYY, h:mm:ss a'));
console.log(expiration.format('MMMM Do YYYY, h:mm:ss a'));
output showing values in variables:
May 20th 2022, 2:17:37 pm
May 20th 2022, 3:14:11 pm
Why is the diff method returning value 63 (time difference in minutes) ?:
current.diff(expiration, "minutes") // 63
It should be under 60 minutes. What piece am I missing ?
EDIT:
Storing the cookie value in ISO 8601 format solves the issue
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
