Conditional Display using Date + server caching

I am using a conditional display logic in Bricks to display a message in the header of a site ONLY if the date is before a certain date. The logic appears to work correctly BUT due to caching (I am using OLS and Cloudflare) the message remains on the site.
It seems like the conditional code should be included even in the cached version but that doesn’t seem to be the case.
As soon as I clear the cache, the logic works correctly.

Any ideas for a solution to this?

You can use JavaScript (or jQuery). First hide it with CSS, then with JS, do “if date less than Sept 20”, show it.

PHP outputs the data no matter what, then the page caches it, which will look the same to every similar viewer.

JavaScript will be executed on each page execution, even if cached… so that is a quick workaround :+1: