Simple Machines Community Forum

SMF Support => SMF 2.1.x Support => Topic started by: Julius_2000 on August 21, 2023, 08:03:56 AM

Title: Incorrect forum time
Post by: Julius_2000 on August 21, 2023, 08:03:56 AM
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.
Title: Re: Incorrect forum time
Post by: Aleksi "Lex" Kilpinen on August 21, 2023, 08:13:55 AM
Just for kicks, what happens if you fix that date/time format? ( To use UTC )
https://tc39.es/ecma262/#sec-date-time-string-format
Title: Re: Incorrect forum time
Post by: Julius_2000 on August 21, 2023, 08:50:57 AM
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.