I'm having problem with manipulation of dates. I have a variable savedTime variable in localstorage which contains this date:
Wed Aug 31 2016 16:31:30 GMT-0300 (Hora oficial do Brasil)
I need add 1 hour for this variable savedTime to check if passed 1 hour:
var savedTime = new Date(savedTime); //converts string to date object
var checkExpired = savedTime.setHours(savedTime.getHours() + 1); //add 1 hour to savedTime
But on trying add 1 hour to this variable converting the string in a object, this (savedTime) returns:
1472675490000
What I expected is the string with + 1 hour:
Wed Aug 31 2016 17:31:30 GMT-0300 (Hora oficial do Brasil)
And compare dates to check if passed 1 hour
var currentDate = new Date();
if(currentDate > checkExpired) {
//passed 1 hour
}
1472675490000with26 Wed Aug 31 2016 22:01:11 GMT+0100 (BST)which cant be compared to be greater than