|
|
@ -294,10 +294,9 @@ def index():
|
|
|
|
|
|
|
|
|
|
|
|
# TODO, check if timezone is calculated right
|
|
|
|
# TODO, check if timezone is calculated right
|
|
|
|
if 'publishedDate' in result:
|
|
|
|
if 'publishedDate' in result:
|
|
|
|
if result['publishedDate'].replace(tzinfo=None)\
|
|
|
|
result['pubdate'] = result['publishedDate'].strftime('%Y-%m-%d %H:%M:%S%z')
|
|
|
|
>= datetime.now() - timedelta(days=1):
|
|
|
|
if result['publishedDate'].replace(tzinfo=None) >= datetime.now() - timedelta(days=1):
|
|
|
|
timedifference = datetime.now() - result['publishedDate']\
|
|
|
|
timedifference = datetime.now() - result['publishedDate'].replace(tzinfo=None)
|
|
|
|
.replace(tzinfo=None)
|
|
|
|
|
|
|
|
minutes = int((timedifference.seconds / 60) % 60)
|
|
|
|
minutes = int((timedifference.seconds / 60) % 60)
|
|
|
|
hours = int(timedifference.seconds / 60 / 60)
|
|
|
|
hours = int(timedifference.seconds / 60 / 60)
|
|
|
|
if hours == 0:
|
|
|
|
if hours == 0:
|
|
|
@ -305,8 +304,6 @@ def index():
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
result['publishedDate'] = gettext(u'{hours} hour(s), {minutes} minute(s) ago').format(hours=hours, minutes=minutes) # noqa
|
|
|
|
result['publishedDate'] = gettext(u'{hours} hour(s), {minutes} minute(s) ago').format(hours=hours, minutes=minutes) # noqa
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
result['pubdate'] = result['publishedDate']\
|
|
|
|
|
|
|
|
.strftime('%a, %d %b %Y %H:%M:%S %z')
|
|
|
|
|
|
|
|
result['publishedDate'] = format_date(result['publishedDate'])
|
|
|
|
result['publishedDate'] = format_date(result['publishedDate'])
|
|
|
|
|
|
|
|
|
|
|
|
if search.request_data.get('format') == 'json':
|
|
|
|
if search.request_data.get('format') == 'json':
|
|
|
|