summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrachele-collin <63007243+rachele-collin@users.noreply.github.com>2020-04-01 18:05:11 +0200
committerAarni Koskela <akx@iki.fi>2022-01-28 17:15:52 +0200
commit9d6803a2700df9228f0b6a9614ec7a44a3ad27bb (patch)
tree53646b6e6805eba349e472b097da849f70618a96
parent90739af21f7f26b126ffb52a136c624aba969acd (diff)
downloadbabel-9d6803a2700df9228f0b6a9614ec7a44a3ad27bb.tar.gz
Parse string date times indepentent of time zone
Parsing a date time string (such as for ``POT-Creation-Date`` or ``PO-Revision-Date``) as UTC time, in particular independent of the local time zone. Closes: #700
-rw-r--r--babel/messages/catalog.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/babel/messages/catalog.py b/babel/messages/catalog.py
index e516fd8..342f737 100644
--- a/babel/messages/catalog.py
+++ b/babel/messages/catalog.py
@@ -10,7 +10,6 @@
"""
import re
-import time
from cgi import parse_header
from collections import OrderedDict
@@ -43,9 +42,7 @@ PYTHON_FORMAT = re.compile(r'''
def _parse_datetime_header(value):
match = re.match(r'^(?P<datetime>.*?)(?P<tzoffset>[+-]\d{4})?$', value)
- tt = time.strptime(match.group('datetime'), '%Y-%m-%d %H:%M')
- ts = time.mktime(tt)
- dt = datetime.fromtimestamp(ts)
+ dt = datetime.strptime(match.group('datetime'), '%Y-%m-%d %H:%M')
# Separate the offset into a sign component, hours, and # minutes
tzoffset = match.group('tzoffset')