-
AuthorPosts
-
February 3, 2021 at 6:45 am #8946macromarkParticipant
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?
February 3, 2021 at 8:05 pm #8947macromarkParticipantThis is what the timestamp looks like in the list
This is what the timestamp says when you edit the bar
February 4, 2021 at 7:05 am #8953macromarkParticipantThe 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?
February 4, 2021 at 7:47 pm #8954macromarkParticipantHello? Anyone there?
February 4, 2021 at 9:00 pm #8955Aakash ChakravarthyKeymasterHi Mark,
I’ll get back to you on this.
Thanks,
AakashFebruary 4, 2021 at 9:22 pm #8956macromarkParticipantI’ll get back to you on this.
OK, thanks
February 4, 2021 at 10:38 pm #8958Aakash ChakravarthyKeymasterMark,
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,
AakashFebruary 4, 2021 at 11:20 pm #8959macromarkParticipantAakash,
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.
February 5, 2021 at 12:36 am #8960Aakash ChakravarthyKeymasterMark,
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,
AakashFebruary 5, 2021 at 12:45 am #8961macromarkParticipantHello 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
February 5, 2021 at 12:50 am #8962Aakash ChakravarthyKeymasterThe 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
February 5, 2021 at 12:52 am #8963macromarkParticipantSorry, 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.
February 5, 2021 at 12:58 am #8964macromarkParticipantHere’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?
February 5, 2021 at 1:00 am #8965Aakash ChakravarthyKeymasterhmmm 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 number247
and248
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,
AakashFebruary 5, 2021 at 1:02 am #8967macromarkParticipantOK, great… I’ll give that a try and will report back. Thanks!
FWIW – I see the screen shots I posted above but not yours.
-
AuthorPosts
- You must be logged in to reply to this topic.