How to access a page on given time duration only?

I want a certain page which can only be accessed at the given time duration and on certain days too only to the site members. I am not getting the right code for the time.

Explain what you are trying to do, what works, and what doesn’t. Also, add any code in a code block as stated in the Forum Guidelines .

I want to restrict a certain page access from a website using the site member e-mail from which they had logged in on the basis of allotted time and days.

Like true in the database will give access to the member on that specific day on the given time duration only.

$w.onReady( function () {
// Write your code here
const Display = [2,3,4,6,7]; // 0 is Sunday
let today = new Date().getDay();
if (Display.includes(today)) {
wixWindow.openModal( “Developer Prac-Web” );
}

});
I have previously done this, But its not either working for the day. And now I want to add the time criteria too.

@vinamrata1086 I tried it out and it seems OK, to me. Now, you just need to handle the time.

@yisrael-wix I don’t how the above code is working for u but it gives error to me in the openModal. And have u any idea to add work on time criteria too?

@vinamrata1086 I didn’t try an open modal, just a message. What error are you getting?

@yisrael-wix The options parameter that is passed to the openModal method cannot be set to the value .

@vinamrata1086 You need an options parameter. It is not optional.