php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #70801 More concise and clearly labeled time zones
Submitted: 2015-10-27 15:20 UTC Modified: 2017-04-24 12:07 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: scott at connerly dot net Assigned:
Status: Wont fix Package: Date/time related
PHP Version: Irrelevant OS: n/a
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: scott at connerly dot net
New email:
PHP Version: OS:

 

 [2015-10-27 15:20 UTC] scott at connerly dot net
Description:
------------
Currently, DateTimeZone::listIdentifiers() returns all 417 Zones and Links that were ever available in the tz database. Additionally, the only names supplied by DateTimeZone::getLocation() are the actual time zone names, not any user-friendly names.

This request to PHP is the companion request to this request to Ruby:
https://github.com/rails/rails/issues/22088
which references this array:
https://github.com/rails/rails/blob/2cecd213702fedce27840a62d07df1359d67f351/activesupport/lib/active_support/values/time_zone.rb#L31

My requests:
 - Add a mechanism to get just the primary identifiers, perhaps by a new constant similar to ALL_WITH_BC, like PRIMARY_ACTIVE. This would return the curated list of 149 rather than all 417.
 - Add a mechanism to get the user-friendly name for an identifier. Perhaps this could happen by adding an array element in DateTimeZone::getLocation()s' results.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-10-28 01:26 UTC] scott at connerly dot net
In the case that there is more than one relevant user-friendly name for a time zone identifier, an array of user-friendly names may be required. Example: Asia/Tokyo could have the friendly names of Osaka, Sapporo, or Tokyo.
 [2015-10-31 02:40 UTC] scott at connerly dot net
FYI, here's the repo I created to utilize Ruby's timezone list in PHP.
https://github.com/scottconnerly/timezone
Its far from elegant, but it gets the job done. Its never great to scrape content, but for now, it'll do.
 [2017-04-24 12:07 UTC] heiglandreas@php.net
-Status: Open +Status: Wont fix
 [2017-04-24 12:07 UTC] heiglandreas@php.net
The list you are showing in the screenshot does NOT contain Timezones (at least in the top) but Timezone-Abbreviations. These should NOT be used to assign timezones.

A better approach would  be to select a city and then use geolocation tools available to determine the correct timezone for that area.

In any case that's not something I'd see within the PHP-Core but within a userland library.
 [2019-06-17 17:33 UTC] webmaster at schoenstatt dot link
I really think this is a necessary problem to fix. PHP does not currently provide a full solution for working with time zones because of the sheer quantity and the inability to distinguish between current and outdated ones. Please look at Scott's solution, as it really helped me as a work around. It would be great to get this integrated into the language!

https://github.com/scottconnerly/timezone
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Aug 08 01:05:45 2022 UTC