I have an issue in my Laravel application.
The issue is that Internet Explorer is giving the wrong time compared to Firefox or Chrome in JavaScript.
My JavaScript Code:
console.log(expDate + ' --> ' + new Date(expDate).getTime() + " --> " + $.now());
It's output in Firefox:
09/25/18 4:31 PM UTC --> 1537893060000 --> 1537875054235
Output in IE:
09/25/18 4:31 PM UTC --> -1617866940000 --> 1537875062939
Can anyone help me with how to resolve the issue.
I want it so the new Date(expDate).getTime()
gives the correct time in all browsers.
Any help will be appreciated.
Solution
My Issue was that new Date(expDate).getTime()
was giving different timestamp in IE. So I solved my issue by to set date.
IE considers 09/25/18 4:31 PM UTC this date to 09/25/1918. Firefox considers 09/25/18 4:31 PM UTC this date to 09/25/2018.
So I just change the date format and picking exact date with exact years like 09/25/2018 4:31 PM UTC. So I get same result as in firefox.
Thanks