|
|
Memory
Guest
|
 |
« Reply #2 on: April 10, 2024 @971.12 » |
|
Thank melon!  This is gonna make my site feel 100% more personal!... That is if I can revise it before Monday. Been months since I made a "true" update.
|
|
|
Logged
|
|
|
|
Memory
Guest
|
 |
« Reply #3 on: April 10, 2024 @2.80 » |
|
|
|
« Last Edit: July 31, 2024 @651.27 by Memory »
|
Logged
|
|
|
|
|
|
JINSBEK
Full Member ⚓︎
  

Yoroshiku.
⛺︎ My Room


|
 |
« Reply #6 on: December 08, 2024 @984.55 » |
|
Hey, this is pretty cool. I always thought it was cool that Sprayground closed their website on Shabbat, and now we can, too. Haha. @VioletHeaven , take a look at this!
|
|
|
Logged
|
|
|
|
|
|
|
sen.fish
Casual Poster ⚓︎

 ⛺︎ My Room
|
 |
« Reply #10 on: February 12, 2025 @459.42 » |
|
But I am curious, how do you set it to it closes for a particular time zone? Considering the default is GMT. The getDay() method uses the local time zone! See: "The getDay() method of Date instances returns the day of the week for this date according to local time" ( MDN docs). If you want to use a specific timezone, you could try this code (replacing timeZone: "America/New_York" with the time zone of your choice): var sc = {};
sc.closedPage = "closed.html";
sc.closedDays = ["Monday"];
sc.weekDays = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
var dayNow = new Date().toLocaleString("en-US", {
timeZone: "America/New_York",
weekday: 'long'
});
// Trigger this site closer!
function shutItDown() {
sc.dayNow = new Date().toLocaleString("en-US", {timeZone: "America/New_York", weekday: 'long' });
if (sc.closedDays.includes(sc.dayNow)) {
console.log("Gordon Ramsay screams: Shut it Down!!!");
window.location.replace(sc.closedPage);
}
}
shutItDown();
|
|
|
Logged
|
|
|
|
|
|
|