Trying to hyper-target our lurkers and incentivize sign-ups šŸš€ (and run a JS on login)

You can set the time based off the current time. Double check this code. You can test it out in your browser’s developer tools to see that it’s working. The math could be simplified.

<script type="text/discourse-plugin" version="0.8">
        if (api.getCurrentUser()) {
        const now = new Date();
        let time = now.getTime();
        time += 60 * 60 * 24 * 7 * 1000; // seconds * minutes * hours * days * milliseconds
        now.setTime(time);
        document.cookie = "logged_in=true; expires=" + now.toUTCString();
    }
</script>