Dear Darro,
Thank you for this report, date format is indeed difficult.
Let’s try to debug that:
First thing to look at, I use get_the_date() in the shortcode to get the post date from WordPress. This function takes the language set in the WordPress administration panel. So maybe try to change it to EN_AU Australia if it’s not already.
The second thing is in the JavaScript, I use a function to translate the date to the local of the user.
let postDate = new Date(postdatas.date);
postDate = postDate.toLocaleDateString(undefined, {
year: "numeric",
month: "long",
day: "numeric",
});
So I will have a look if the first solution doesn’t work 😉
Have a nice day
-
This reply was modified 1 year, 3 months ago by
Camille V.
Thread Starter
darro
(@darro)
Hey, wow, thanks for the quick response.
The Site Language is “English (Australian)”
The timezone is “Sydney”
So it is currently reporting “Universal time is 2021-05-12 06:46:17. Local time is 2021-05-12 16:46:17.”
I’m using a custom Date format of “l, F j, Y” to get the day of the week in the post.
Time is in the default “g:i a” format.
Does this help?
Thank
Darro
-
This reply was modified 1 year, 3 months ago by
darro.
Okay so, I was sending the date to javascript as a Unix date format, which is based on UTC timezone. So your date set in UTC+10 was converted to UTC without substracting 10 hours.
Then the javascript was converting this UNIX date (thinking it was in UTC) to a readable date format at your local machine timezone, so adding 10 hours.
I changed get_the_date to return the date as a readable date, javascript is smart enough to read it and transcribe it to the local format, without changing timezone.
So the date shown is now the same as in your administration.
The update V1.12 is coming soon, I’m adding two or three other things with it.
Have a nice day,
Camille
-
This reply was modified 1 year, 3 months ago by
Camille V.
Thread Starter
darro
(@darro)
Thanks you very much.
No rush, whenever you get the chance.
I’m really looking forward to the multiple markers in V2!
Cheers
Darro
Dear Darro,
V1.12.0 is up in a few minutes, with the fix for this issue 😉
Please let me know if something is still not working.
Have a nice day,
Camille
Thread Starter
darro
(@darro)
Hi Camille
Yep, that’s done the trick. Perfect.
Thanks very much for such as quick response.
Cheers
Darro