• I noticed today that one of my timed content rules was not working correctly.

    I checked the rule, but it looked correct.

    Today’s date, April 9th, was in the exception list, and so the rule should not have been active today, but I could see from the content on the website that the rule was active.

    It was also in the rule description at the top, so I’m pretty sure it was set up correctly.

    Regardless, I deleted the excepted date, and then re-added the same date to the exception list.

    My rule now works!

    There is some bug here which I cannot pin down. I suspect its something to do with me setting up the rules before daylight saving time came into effect about a month ago. Since then that my rules seem to be behaving unpredictably.

    I don’t want to go through all my rules, deleting all the dates I’ve carefully added, and then re-adding them. Especially as I don’t fully understand the issue and so I can’t even guarantee this will solve it.

    Can you shed some light on how the rules work, and how a change of time such as going to daylight savings time may effect them?

    I’m wondering if because I set a rule up starting at midnight, and then the time switched to ‘daylight saving time’ does the rule then start on the wrong date, an hour earlier or some other complication?

    https://www.ads-software.com/plugins/timed-content/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor K. Tough

    (@kjvtough)

    Sorry for not getting back to you sooner.

    I think you’re right w.r.t. DST issues. The exception dates are saved w/ a timestamp on midnight on each date – and they’re generated client-side from hooking into the datepicker JQuery library. For now, you could try going to ~line 225 in /lib/customFields-settings.php and replacing the line with this:

    var HALF_DAY_IN_SECONDS = 60 * 60 * 12;
    var dt = parseInt(Date.parse(dateText) / 1000) + HALF_DAY_IN_SECONDS; // set datetime to noon-ish to dodge possible DST issues.

    This will ensure that each exception date is saved as of noon, so an hour’s sway in either direction should ensure the correct date is still checked for. This code is already in my dev code so anything you do shouldn’t get broken when 3.0 comes out.

    Thread Starter RJS Media

    (@rjs-media)

    Hello Ken

    Thank you for the reply.

    Can you tell me whether this will solve the issue I have with my current rules, or whether it will solve them for new rules created from this point forwards?

    Thanks

    Rob

    Plugin Contributor K. Tough

    (@kjvtough)

    Unfortunately, you’ll have to reset the exception dates in your current rules after adding the patch, but going forward you should be good.

    Thread Starter RJS Media

    (@rjs-media)

    Hi

    I’ve tried to implement your fix, but I’ve two problems.

    Line 225 which I am trying to replace is actually blank, so there’s nothing to replace.

    And if I do paste the code in, my software indicates a syntax error on those two lines anyway, so I figure that this is not the intended place for the code to be placed.

    Can you give me a more specific marker where the code should be inserted?

    If it helps, lines 224 – 227 look like this in my customFields-settings.php file:

    FUNC;

    $timed_content_rule_exceptions_custom_fields = array(
    array(

    Thanks

    Rob

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Exception date not always working’ is closed to new replies.