Created
June 16, 2014 09:29
-
-
Save Infocatcher/6b3f9d79ef66d14fabc1 to your computer and use it in GitHub Desktop.
Max JavaScript date
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Result: 0x1eb208c2dc0000 (Sat, 13 Sep 275760 00:00:00 GMT) | |
var time = 0; | |
var add = 0x10000; | |
for(;;) { | |
var newTime = time + add; | |
if(newTime == time) { | |
alert("Looke like max integer: 0x" + time.toString(16)); | |
break; | |
} | |
var date = new Date(newTime); | |
if(date.getTime()) { | |
add = Math.floor(add*10); | |
} | |
else { | |
if(add > 1) { | |
add = Math.floor(add/2); | |
if(add >= 1) | |
continue; | |
} | |
alert("Max: 0x" + time.toString(16) + "\n" + new Date(time).toUTCString()); | |
break; | |
} | |
time = newTime; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment