phpBB

Development Discussion Board

phpBB's testing ground of bleeding edge code
Advanced search

[RFC|Merged] Switch to PHP timezone handling

These requests for comments 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.

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

Postby Oleg » Wed May 04, 2011 10:50 pm

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.
Oleg
 
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am

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

Postby igorw » Thu May 05, 2011 3:49 pm

That doesn't look too bad. Would be fine imo.
User avatar
igorw
Registered User
 
Posts: 500
Joined: Thu Jan 04, 2007 11:47 pm

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

Postby Sierron » Thu May 05, 2011 10:40 pm

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)
User avatar
Sierron
Registered User
 
Posts: 62
Joined: Wed Aug 25, 2010 11:41 am

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

Postby Oleg » Fri May 06, 2011 1:03 am

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?
Oleg
 
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am

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

Postby naderman » Fri May 06, 2011 2:03 am

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.
www.naderman.de
Move your forum to Forumatic - we'll take care of maintenance & spam
User avatar
naderman
Development Team Leader
Development Team Leader
 
Posts: 1650
Joined: Sun Jan 11, 2004 2:11 am
Location: Karlsruhe, Germany

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

Postby Oleg » Fri May 06, 2011 3:33 am

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?
Oleg
 
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am

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

Postby igorw » Fri May 06, 2011 9:01 am

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
igorw
Registered User
 
Posts: 500
Joined: Thu Jan 04, 2007 11:47 pm

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

Postby Sierron » Fri May 06, 2011 9:36 am

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?
User avatar
Sierron
Registered User
 
Posts: 62
Joined: Wed Aug 25, 2010 11:41 am

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

Postby igorw » Fri May 06, 2011 11:40 am

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

Indeed, that's what we currently have.
User avatar
igorw
Registered User
 
Posts: 500
Joined: Thu Jan 04, 2007 11:47 pm

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

Postby AmigoJack » Fri May 06, 2011 2:09 pm

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. :)
User avatar
AmigoJack
Registered User
 
Posts: 59
Joined: Wed May 04, 2011 7:47 pm
Location: グリーン ヒル ゾーン

Previous Next

Return to [3.1/Ascraeus] Merged RFCs

Who is online

Users browsing this forum: Alexa [Bot] and 4 guests