dateutil/dateutil

Parser UTC offset logic is inverted

Open

#70 ouverte le 31 mars 2015

Voir sur GitHub
 (20 commentaires) (0 réactions) (0 assignés)Python (470 forks)batch import
enhancementhelp wantedmedium-difficultyparsertime zones

Métriques du dépôt

Stars
 (2 189 stars)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

my python-dateutil version: 2.4.1

i am in the time zone: CST(UTC+8)

when i use dateutil, it return different with other tools

pyhton-dateutil:

In [21]: parse("2015-03-31 00:01 UTC").astimezone(cst)
Out[21]: datetime.datetime(2015, 3, 31, 8, 1, tzinfo=tzlocal())

In [22]: parse("2015-03-31 00:01 UTC+1").astimezone(cst)
Out[22]: datetime.datetime(2015, 3, 31, 9, 1, tzinfo=tzlocal())

In [23]: parse("2015-03-31 00:01 UTC-1").astimezone(cst)
Out[23]: datetime.datetime(2015, 3, 31, 7, 1, tzinfo=tzlocal())

linux date command:

yu at debian in ~ 
(! 4076)-> date -d "2015-03-31 00:01 UTC"
Tue Mar 31 08:01:00 CST 2015
yu at debian in ~ 
(! 4076)-> date -d "2015-03-31 00:01 UTC+1"
Tue Mar 31 07:01:00 CST 2015
yu at debian in ~ 
(! 4077)-> date -d "2015-03-31 00:01 UTC-1"
Tue Mar 31 09:01:00 CST 2015

Guide contributeur