|
|
|
|
|
|
Memory 
Guest
|
 |
« Reply #3 on: a Spring night » |
|
|
|
|
|
« Last Edit: a Summer day by Memory »
|
Logged
|
|
|
|
|
|
|
|
JINSBEK
Sr. Member ⚓︎
   


Yoroshiku. ⛺︎ My Room
Artifacts:

|
 |
« Reply #6 on: a Winter night » |
|
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: a Winter day » |
|
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
|
|
|
|
|
|
|
|
|
|
|
|