Skip to content

Commit 6f48d4a

Browse files
committed
Revert "Fix unrecognized 'Z' UTC designator"
This reverts commit 0e02d5f. Conflicts: doc/source/whatsnew/v0.15.2.txt
1 parent c03e92f commit 6f48d4a

File tree

3 files changed

+4
-15
lines changed

3 files changed

+4
-15
lines changed

doc/source/whatsnew/v0.15.2.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,3 @@ Bug Fixes
9393

9494
- Bug in `pd.infer_freq`/`DataFrame.inferred_freq` that prevented proper sub-daily frequency inference
9595
when the index contained DST days (:issue:`8772`).
96-
- Regression in ``Timestamp`` does not parse 'Z' zone designator for UTC (:issue:`8771`)

pandas/src/datetime/np_datetime_strings.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,7 @@ convert_datetimestruct_local_to_utc(pandas_datetimestruct *out_dts_utc,
363363
* to be cast to the 'unit' parameter.
364364
*
365365
* 'out' gets filled with the parsed date-time.
366-
* 'out_local' gets set to 1 if the parsed time contains timezone,
367-
* to 0 otherwise.
366+
* 'out_local' gets whether returned value contains timezone. 0 for UTC, 1 for local time.
368367
* 'out_tzoffset' gets set to timezone offset by minutes
369368
* if the parsed time was in local time,
370369
* to 0 otherwise. The values 'now' and 'today' don't get counted
@@ -786,13 +785,9 @@ parse_iso_8601_datetime(char *str, int len,
786785

787786
/* UTC specifier */
788787
if (*substr == 'Z') {
789-
/* "Z" should be equivalent to tz offset "+00:00" */
788+
/* "Z" means not local */
790789
if (out_local != NULL) {
791-
*out_local = 1;
792-
}
793-
794-
if (out_tzoffset != NULL) {
795-
*out_tzoffset = 0;
790+
*out_local = 0;
796791
}
797792

798793
if (sublen == 1) {

pandas/tseries/tests/test_tslib.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import datetime
77

88
from pandas.core.api import Timestamp, Series
9-
from pandas.tslib import period_asfreq, period_ordinal, get_timezone
9+
from pandas.tslib import period_asfreq, period_ordinal
1010
from pandas.tseries.index import date_range
1111
from pandas.tseries.frequencies import get_freq
1212
import pandas.tseries.offsets as offsets
@@ -298,11 +298,6 @@ def test_barely_oob_dts(self):
298298
# One us more than the maximum is an error
299299
self.assertRaises(ValueError, Timestamp, max_ts_us + one_us)
300300

301-
def test_utc_z_designator(self):
302-
self.assertEqual(get_timezone(Timestamp('2014-11-02 01:00Z').tzinfo), 'UTC')
303-
self.assertEqual(get_timezone(Timestamp('2014-11-02 01:00Z00').tzinfo), 'UTC')
304-
self.assertRaises(ValueError, Timestamp, '2014-11-02 01:00Z0')
305-
306301

307302
class TestDatetimeParsingWrappers(tm.TestCase):
308303
def test_does_not_convert_mixed_integer(self):

0 commit comments

Comments
 (0)