Permalink
Browse files

* Fix date parsing issues.

  • Loading branch information...
Danny Allen
Danny Allen committed May 19, 2014
1 parent bf2c765 commit f72961736718ec4a6af5aa5190b61318c280738c
Showing with 17 additions and 5 deletions.
  1. +17 −5 enzymeproject/feed.py
View
@@ -6,11 +6,23 @@
from datetime import timedelta, datetime
def parse_date(datestring):
return (
datetime.strptime(datestring[:-6].replace("T", " "), "%Y-%m-%d %H:%M:%S") +
timedelta(hours=int(datestring[-6:-3]))
)
def parse_date(date_string):
try:
# get pure date string without timezone information
pure_date = date_string.replace("T", " ").replace("Z", " ").strip()[0:19]
return (
datetime.strptime(
pure_date,
"%Y-%m-%d %H:%M:%S"
) +
timedelta(
hours=int(pure_date[-8:-6])
)
)
except ValueError:
return None
def get_commits_feed(feed_url, limit=None):

0 comments on commit f729617

Please sign in to comment.