Incorrect forum time

Started by Julius_2000, August 21, 2023, 08:03:56 AM

Previous topic - Next topic

Julius_2000

Hi,

I'm using a banner with countdown timer jaa/php for our forum. In the timer, I've set the timezone to GMT+01:00 in order to align with the London time zone.

var countDownDate = new Date("Aug 21, 2023 17:00:01 GMT+01:00").getTime();
When I'm logged-in to the forum, the countdown time gets displayed correctly. But when I log out, the countdown has a +1 hour deviance. But the same exact timer on our test forum shows the correct timing whether or not I'm logged in.
I checked the forum default time settings for both forums and they're identically set up to UTC - Coordinated Universal Time.

I'm a little confused as to why our public forum would use a different time zone for guests and when logged in (I know you can set your own time zone individually) shows the correct time.

Aleksi "Lex" Kilpinen

Just for kicks, what happens if you fix that date/time format? ( To use UTC )
https://tc39.es/ecma262/#sec-date-time-string-format
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Julius_2000

#2
I tried changing "Aug 21, 2023 ..." to "2023-08-21, ..." but that resulted in NanH... outputs instead of a calculated countdown. I probably wasn't doing it right.

Then I changed it back to how it was before, copy&pasted it back to the ftp theme folder and surprisingly now it shows the correct countdown both logged in& out. Weird.

Edit:
Ah, I should have read more carefully and written it like this
var countDownDate = new Date("2023-08-21T17:00:01+01:00").getTime();

But I can't verify anymore whether it would have made a difference since the old approach seems to mysteriously be working now.

Advertisement: