Skip to content

Instantly share code, notes, and snippets.

@netrunn3r
netrunn3r / refreshat.js
Created September 26, 2021 19:21 — forked from ambercouch/refreshat.js
Refresh the browser and a specific time (23:00:00)
function refreshAt(hours, minutes, seconds) {
var now = new Date();
var then = new Date();
if(now.getHours() > hours ||
(now.getHours() == hours && now.getMinutes() > minutes) ||
now.getHours() == hours && now.getMinutes() == minutes && now.getSeconds() >= seconds) {
then.setDate(now.getDate() + 1);
}
then.setHours(hours);