Req #70801 [Com]: More concise and clearly labeled time zones
| From: | webmaster at schoenstatt dot link | Date: | Mon, 17 Jun 2019 17:33:20 +0000 |
| Subject: | Req #70801 [Com]: More concise and clearly labeled time zones | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-221351@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70801&edit=1
ID: 70801
Comment by: webmaster at schoenstatt dot link
Reported by: scott at connerly dot net
Summary: More concise and clearly labeled time zones
Status: Wont fix
Type: Feature/Change Request
Package: Date/time related
Operating System: n/a
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[2017-04-24 12:07:07] 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.
------------------------------------------------------------------------
[2015-10-31 02:40:16] 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.
------------------------------------------------------------------------
[2015-10-28 01:26:02] 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-27 15:20:18] 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.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70801&edit=1