Last active
December 31, 2017 10:43
-
-
Save gosub/10df42119b8b3bd58e2d19c9b8b95456 to your computer and use it in GitHub Desktop.
Hacker News Time Machine
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
var t = new Date(); | |
t.setFullYear(t.getFullYear() - 3); | |
var past = prompt("HN time machine", t.toISOString().substr(0,10)); | |
if (past != null) { | |
var p = new Date(past); | |
var p1 = (new Date(p.getFullYear(), p.getMonth(), p.getDate(), 0, 0, 0, 0).getTime() + "").slice(0,-3); | |
var p2 = (new Date(p.getFullYear(), p.getMonth(), p.getDate(), 23, 59, 59, 0).getTime() + "").slice(0, -3); | |
var u = "https://hn.algolia.com/?query=&sort=byPopularity&prefix&page=0&dateRange=custom&type=story&dateStart=" + p1 + "&dateEnd="+ p2; | |
window.location.href=u; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment