[RFC|Merged] Switch to PHP timezone handling

These requests for comments/change have lead to an implemented feature that has been successfully merged into the 3.1/Ascraeus branch. Everything listed in this forum will be available in phpBB 3.1.
Post Reply
Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: [RFC|Accepted] Switch to PHP timezone handling

Post by Oleg »

I have not counted the number of timezones in the dropdown but assuming 24 timezone offsets that comes out to 20 timezones per offset, which is about one page of a dropdown box (looking at the forum list on area51 right now in firefox 3). Assuming you know what your timezone offset is you would need to look through at most two such pages of timezones.

The code should be here: https://github.com/p/phpbb3/compare/dev ... z-handling

Edit: looks like the last commit broke migrations, which I forgot about. https://github.com/phpbb/phpbb3/pull/175 needs to be merged for me to work on fixing timezone branch.

Getting this error on login:

[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4527: Undefined index: tz

Could be irrelevant.


You can see the timezone selector by pressing the agreement button on this page: http://108.35.7.206:8071/boards/tz1/ucp ... e=register
Last edited by Oleg on Thu May 05, 2011 5:07 am, edited 1 time in total.

igorw
Registered User
Posts: 500
Joined: Thu Jan 04, 2007 11:47 pm

Re: [RFC|Accepted] Switch to PHP timezone handling

Post by igorw »

That doesn't look too bad. Would be fine imo.

User avatar
Sierron
Registered User
Posts: 62
Joined: Wed Aug 25, 2010 11:41 am
Contact:

Re: [RFC|Accepted] Switch to PHP timezone handling

Post by Sierron »

nn- wrote:You can see the timezone selector by pressing the agreement button on this page: http://108.35.7.206:8071/boards/tz1/ucp ... e=register
That's a huge list :shock: Looks impressive.

But it does look nice.


I still wonder why germany is GMT+2 (o_O)

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: [RFC|Accepted] Switch to PHP timezone handling

Post by Oleg »

Sierron wrote: I still wonder why germany is GMT+2 (o_O)
Are you referring to a political issue, is it incorrectly listed in the timezone selector or is your current GMT offset incorrectly determined by javascript?

User avatar
naderman
Consultant
Posts: 1727
Joined: Sun Jan 11, 2004 2:11 am
Location: Berlin, Germany
Contact:

Re: [RFC|Accepted] Switch to PHP timezone handling

Post by naderman »

Well the problem is that Germany is GMT+1 + DST. I actually searched upwards in GMT + 1 for it first. I think the GMT offsets should not include DST.

Anyway, I think this is going to work.

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: [RFC|Accepted] Switch to PHP timezone handling

Post by Oleg »

naderman wrote:Well the problem is that Germany is GMT+1 + DST. I actually searched upwards in GMT + 1 for it first. I think the GMT offsets should not include DST.
When the page loaded what timezone was selected for you? And what timezone would you have chosen were you actually registering?

igorw
Registered User
Posts: 500
Joined: Thu Jan 04, 2007 11:47 pm

Re: [RFC|Accepted] Switch to PHP timezone handling

Post by igorw »

naderman wrote:Well the problem is that Germany is GMT+1 + DST. I actually searched upwards in GMT + 1 for it first. I think the GMT offsets should not include DST.
Yep. It defaulted to "Africa, GMT+2" here. I have an option "Zürich, GMT+2", but it should be "Zürich GMT+1". The DST offset should not be added.

User avatar
Sierron
Registered User
Posts: 62
Joined: Wed Aug 25, 2010 11:41 am
Contact:

Re: [RFC|Accepted] Switch to PHP timezone handling

Post by Sierron »

naderman wrote:Well the problem is that Germany is GMT+1 + DST. I actually searched upwards in GMT + 1 for it first. I think the GMT offsets should not include DST.
Same for me. I searched in the GMT+1 List and didn't saw it. Then I thought perhaps it's with DST and searched on the GMT+2 list.
nn- wrote:When the page loaded what timezone was selected for you? And what timezone would you have chosen were you actually registering?
igorw wrote: Yep. It defaulted to "Africa, GMT+2" here.
And my option is Berlin GMT+2

besides that: Why do you use GMT and not UTC?

igorw
Registered User
Posts: 500
Joined: Thu Jan 04, 2007 11:47 pm

Re: [RFC|Accepted] Switch to PHP timezone handling

Post by igorw »

Sierron wrote:besides that: Why do you use GMT and not UTC?
Indeed, that's what we currently have.

User avatar
AmigoJack
Registered User
Posts: 110
Joined: Wed May 04, 2011 7:47 pm
Location: グリーン ヒル ゾーン
Contact:

Re: [RFC|Accepted] Switch to PHP timezone handling

Post by AmigoJack »

JS cannot tell you if DST is in effect. Your phpbb_preselect_tz_select() calls .getTimezoneOffset(), which gives me for GMT +0100 (DST) = CEST the value -120. So the JS function does what its name suggests: it gives you literally only the offset. Everybody can check it himself by entering this in the browser's address box:

Code: Select all

javascript:alert( (new Date()).getTimezoneOffset() );
You can only indirectly find out the two different UTC offsets of a user's browser:
  1. Quick and naive implementation
  2. More robust implementation
Right now I'm not sure if DST is always an increment (and never a decrement). But if that's the case you're also able to tell which one is the real timezone (the lower offset) and which one is the DST effect (the higher offset). So you can ultimately also detect that I'm now on summer time, not standard time. Which makes you select the right timezone with JS. :)

Post Reply