Bug #70502 [Opn->Nab]: Kathmandu time zone offset is wrong
| From: | derick@php.net | Date: | Tue, 15 Sep 2015 14:29:20 +0000 |
| Subject: | Bug #70502 [Opn->Nab]: Kathmandu time zone offset is wrong | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-196012@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70502&edit=1
ID: 70502
Updated by: derick@php.net
Reported by: phil dot davis at inf dot org
Summary: Kathmandu time zone offset is wrong
-Status: Open
+Status: Not a bug
Type: Bug
Package: Date/time related
Operating System: Multiple
PHP Version: 5.5.29
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
As you have already realized, NPT is used for other areas besides Katmandu as well. The original
(PHP 4 and PHP 5.0) code had IIRC a link between NPT and the timezone name, so that is why St. Johns
is at the top of the list for the NPT code.
But the region did use IST between 1919 and 1985 as I've commented on the Pull Request. There
is nothing wrong there.
timezone_name_from_abbr() can make use of a little more information, for example the UTC offset. If
you use that with Kathmandu's offset, it works:
var_dump(timezone_name_from_abbr("NPT", 20700));
shows:
string(13) "Asia/Katmandu"
Previous Comments:
------------------------------------------------------------------------
[2015-09-15 12:39:18] phil dot davis at inf dot org
Looking in https://github.com/php/php-src/blob/master/ext/date/lib/timezonemap.h
Search for "npt".
Unfortunately lots of places seem to like to use the time zone abbreviation "npt". The
first of these is "America/St_Johns". That is a bit unfortunate, but part of life, I guess
:)
So the only real problem I see here is with Asia/Kathmandu and Asia/Katmandu being listed in the
Indian Stndard Time zone "ist".
The proposed fix for that is the referenced pull request 1522 mentioned here.
------------------------------------------------------------------------
[2015-09-15 11:58:40] phil dot davis at inf dot org
Description:
------------
NPT is supposed to be the abbreviation for Nepal Time (Asia/Kathmandu)
http://www.timeanddate.com/time/zones/
but timezone_name_from_abbr("NPT") returns:
string(16) "America/St_Johns"
DateTimeZone::listAbbreviations() shows Asia/Kathmandu with offset 19800.
19800 = 3600 * 5.5 which is UTC+05:30 - that is the time zone for Indian cities like Kokata.
Nepal Kathmandu is UTC+05:45 so the offset should be 3600 * 5.75 = 20700
Test script:
---------------
$x = timezone_name_from_abbr("NPT");
var_dump($x);
$y = DateTimeZone::listAbbreviations();
var_dump($y);
Expected result:
----------------
$x should have "Asia/Kathmandu"
The output in $y should have for Asia/Kathmandu and Asia/Katmandu
[7]=>
array(3) {
["dst"]=>
bool(false)
["offset"]=>
int(20700)
["timezone_id"]=>
string(14) "Asia/Kathmandu"
}
[8]=>
array(3) {
["dst"]=>
bool(false)
["offset"]=>
int(20700)
["timezone_id"]=>
string(13) "Asia/Katmandu"
}
Actual result:
--------------
string(16) "America/St_Johns"
In the $y output:
[7]=>
array(3) {
["dst"]=>
bool(false)
["offset"]=>
int(19800)
["timezone_id"]=>
string(14) "Asia/Kathmandu"
}
[8]=>
array(3) {
["dst"]=>
bool(false)
["offset"]=>
int(19800)
["timezone_id"]=>
string(13) "Asia/Katmandu"
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70502&edit=1