Usage of standard timezones to get real times (daylight savings) #2578

Open
xcript opened this Issue Aug 2, 2013 · 7 comments

Comments

Projects
None yet
9 participants

xcript commented Aug 2, 2013

I'm working with CI-Bonfire, which ist based on CI. As I need the timezones for getting the real and current time of a user, I found a great bug of CI: the timezone handling. CI is working with timezones like "UM4" or "UP1". But WHY? Why does CI not uses standard timeszone like "Europe/Berlin", which handles daylight saving times without any problem?

Here (ci-bonfire/Bonfire#851) I posted a solution for the timezone-menu for CI-Bonfire, which based on CI's timezone-menu, but uses standard timezones. Bonfire saves the timezone of an user in it's user table. If it is an user of Germany, than you currently get the wrong time, because CI sets "UP1" for the user, but his current time ist UTC+2 - not UTC+1!

Please explain, why CI uses non standard timezones. I suggest to switch CI competely to the standard timezones.

Contributor

StorytellerCZ commented Aug 2, 2013

+1 Coming from A3M, I just had to make a workaround, but having this in CI itself would help us significantly and I would appreciate it for my other projects as well. The question is if there is place for it in CI3, if there is enough time to make this happen and how much backward compatibility can there be.

xcript commented Aug 2, 2013

Thanks for the link!

IMHO there is no need for backward comaptibilty. The CI timezones are a wrong approach, so they should be removed completely. And if someone migrates a project to CI3, than there are much more difficult things to do as correcting the timezones, so this should be done anyway.

Contributor

cryode commented Aug 3, 2013

👍 The proprietary time zone names are weird.

Related: DateTime objects are available since PHP 5.2.0, so they could be used throughout CI now. All of the date helpers and probably other places could be "improved" (less code / easier to read -- performance might take a hit) by using DateTime where appropriate.

Contributor

Razican commented Oct 31, 2014

This would be a great feature implementation. Since now CodeIgniter supports all PHP supported timezones, it would be great that all the date helper supports them.

@narfbg narfbg added this to the v.4.0.x milestone Jan 20, 2015

Is this still an issue that should be dealt with? Other than the timezone menu, the date_helper doesn't seem to offer anything that PHP doesn't. Is the timezone menu worth rewriting the date_helper for?

timezone_identifiers_list() function should be used to get timezone array. http://php.net/manual/en/function.timezone-identifiers-list.php
What is other developer's opinion?

I think that you are right @pmbaldha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment