var newDate = new Date(1012256900000);
var newDate = new Date($rootScope.lastLoginTime);
Gonna take a guess here, but look at what I did in the browser console:
new Date(1463256900000) > [date] Sat May 14 2016 21:15:00 GMT+0100 new Date("1463256900000") > [date] Invalid date
Completely wild guess, but perhaps you should ensure you are passing a number, not a string, to
new Date() - the constructor behaves very differently in either case.
Consider instead trying this:
var newDate = new Date(); newDate.setTime($rootScope.lastLoginTime);
setTime takes a numeric argument only, and will convert your string to a number for you if you pass it one.