How to show popup window on weekdays?

Good day!
A pop-up window with a discount offer. How to implement it show on the website only from Monday to Thursday?
March 12th 20 at 08:00
3 answers
March 12th 20 at 08:02
Solution
if ([ 1, 2, 3, 4 ].includes(new Date().getDay())) {
 // show the window
}
March 12th 20 at 08:04
Solution
var d = new Date();
 var n = d.getDay()
if(n<=4)myFunc();
Conditions should be two: 1 <= n && n <= 4 - days of the week in js start from 0 (Sunday). - garth81 commented on March 12th 20 at 08:07
March 12th 20 at 08:06
Solution
The same thing with php.
A js solution is fine, but keep in mind that it will work with the date of the client and not the fact that the date will be correct and you want to synchronize the date with the server + to consider time zones.
if (intval(date('N')) < 5) {
...
}

Find more questions by tags JavaScript