Viewing 15 posts - 1 through 15 (of 21 total)
  • Author
    Posts
  • macromark
    Participant

    Hi – I created an announcement bar earlier today and scheduled it to start running on 2/3/2021. However, it started much earlier today (2/2/2021). My local time is set to “New York” but it appears that the plugin is using universal time instead. Is there a fix for this?

    macromark
    Participant

    This is what the timestamp looks like in the list

    This is what the timestamp says when you edit the bar

    macromark
    Participant

    The PHP installation for our WordPress site is set to UTC (universal time). We’ve tried changing that (thinking that might be the issue) but have been unsuccessful in making the change for some reason. Is your plugin looking at the PHP timezone?

    macromark
    Participant

    Hello? Anyone there?

    Hi Mark,

    I’ll get back to you on this.

    Thanks,
    Aakash

    macromark
    Participant

    I’ll get back to you on this.

    OK, thanks

    Mark,

    I believe you are talking about the “schedule duration” option.

    The announcement is displayed as per the date on the user. If the user’s date is between the given date range then the announcement will be displayed.

    The “published date” you have mentioned is the date when the announcement was “modified/published”. This is just an internal date for your reference.

    Thanks,
    Aakash

    macromark
    Participant

    Aakash,

    Per my first post, the scheduled duration appears to be honoring UTC instead of my local time zone. As a result, the banner that was scheduled to begin displaying on 2/3/2021 actually started displaying on 2/2/2021… five hours before it was supposed to. I don’t know if this is related the publish time… taking a guess it is because that is 5 hours ahead of me.

    If your plugin is designed to honor my local time, that doesn’t appear to be happening. I could implement a workaround for this if I had the option to choose starting and ending times for the schedule but without that option I have to rely on the date matching my local date.

    Mark,

    Yes, the JS API was returning UTC instead of local time. I need to revisit this API.

    For now can you please make this change ?
    It should now check the date as per the user’s local time.

    Insert this + 'T00:00:00' like highlighted below.

    After saving, clear your site cache by ctrl+f5 any WP Cache to see the latest changes. /wp-content/plugins/announcer/public/css/style.css?ver=5.0

    I’ll fix this in the next version of the plugin.

    Thanks,
    Aakash

    macromark
    Participant

    Hello Aakash,

    I don’t understand your instructions. Are you saying I should add + 'T00:00:00' to the stylesheet? If so, how? What syntax?

    thanks, Mark

    The end result should be like in the screenshot above. Edit lines 247, 248 in script.js.

    Correction – The file to clear cache for is this /wp-content/plugins/announcer/public/js/script.js?ver=5.0

    macromark
    Participant

    Sorry, I do not see a screen shot in your post. Tried FireFox, Chrome … no screen shot. I’ll open the script file and see if I can figure it out.

    macromark
    Participant

    Here’s what I see
    var schedule_from = Date.parse(this.props.schedule_from) || (now – 1);
    var schedule_to = Date.parse(this.props.schedule_to) || (now + 1);

    What would I change those to?

    hmmm strange. I could see the image from side. Not sure if the image is blocked.. it should not happen.

    So basically in file announcer/public/js/script.js at line number 247 and 248

            var schedule_from = Date.parse(this.props.schedule_from) || (now - 1);
            var schedule_to = Date.parse(this.props.schedule_to) || (now + 1);

    change it to

            var schedule_from = Date.parse(this.props.schedule_from + 'T00:00:00') || (now - 1);
            var schedule_to = Date.parse(this.props.schedule_to + 'T00:00:00') || (now + 1);

    Thanks,
    Aakash

    macromark
    Participant

    OK, great… I’ll give that a try and will report back. Thanks!

    FWIW – I see the screen shots I posted above but not yours.

Viewing 15 posts - 1 through 15 (of 21 total)
  • You must be logged in to reply to this topic.

Subscribe for updates

Get updates on the WordPress plugins, tips and tricks to enhance your WordPress experience. No spam. View newsletter