Form valid from / expiry
-
Hi
Some time ago, you helped me with implementing an ‘expiry date’ for a form, whereby if a user tried to access the form after a fixed date it would redirect to a different page. The code you gave me was :
(function(){
var current = new Date(), limit = new Date(2019, 2, 29);
if(limit < current) document.location.href = ‘https://mywebsite/redirectpage’;
})()
This has been working great. Just what I needed, but now I also want to incorporate a ‘valid from’ date. I assume this just means adding to the ‘if’ statement?Can I modify it like this?
(function(){
var current = new Date(), limit = new Date(2019, 5, 31), limit2 = new Date(2019, 3, 31);
if(limit < current) document.location.href = ‘https://mywebsite/redirectpage’;
if(limit2 > current) document.location.href = ‘https://mywebsite/redirectpage2’;
})()
- The topic ‘Form valid from / expiry’ is closed to new replies.