• I have tried a few tests on a staging site using UTC to determine if the show / hide of the banner worked, but it will not work. And now I’m questioning why I purchased a pro license. Using the following format: 24 Oct 2024 12:46:00

    Is this fired via a cron event?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author rpetersen29

    (@rpetersen29)

    Hi @mikeviele

    Sorry about the difficulty using the UTC time. That feature is long overdue for an upgrade. Working with time, more specifically timezones, can be difficult, so standardizing the timezone was the choice I made in order to keep things working properly. But I do understand it’s a better user experience to work in your own timezone, and possibly have a datetime picker to make that easier.

    The logic currently sits in the backend php plugin files. It uses php DateTime, https://www.php.net/manual/en/class.datetime.php. And its used in a function that purely determines whether to show or hide the banner. This is executed on runtime or cached depending on your site settings. Until i update that logic, you can use this PHP interpreter to play around with values, https://www.w3schools.com/php/phptryit.asp?filename=tryphp_compiler. With the code:

    <!DOCTYPE html>
    <html>
    <body>

    <?php
    $curr_date = new DateTime('now', new DateTimeZone('UTC'));
    $start_date = new DateTime('24 Oct 2024 12:46:00');

    // Compare the dates
    if ($curr_date < $start_date) {
    echo 'Shown';
    } else {
    echo 'Not shown';
    }
    ?>

    </body>
    </html>

    Just change the date in $start_date and press “Run >” to see if your date will work.

    Thread Starter Mike Viele

    (@mikeviele)

    TY for replying so quickly. I had to wrap my brain around this a bit.

    This was the reason I purchased pro so for it not to work is a bit of a bummer. I do, however, appreciate your responsiveness and willingness to explain how things currently work in the plugins logic.

    • This reply was modified 4 weeks ago by Mike Viele.
    Plugin Author rpetersen29

    (@rpetersen29)

    Ah yeah good catch. I have two bits of logic in there for start and end date, i think i sent you the start date one. So the start date would still be the logic above, and end date would be

    <!DOCTYPE html>
    <html>
    <body>

    <?php
    $curr_date = new DateTime('now', new DateTimeZone('UTC'));
    $end_date = new DateTime('24 Oct 2024 12:46:00');

    // Compare the dates
    if ($curr_date > $end_date) {
    echo 'Shown';
    } else {
    echo 'Not shown';
    }
    ?>

    </body>
    </html>

    For reference. at 10:05 EST i outputted $curr_date and it returned 2024-10-25 14:05:41

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.