|
@@ -159,8 +159,8 @@ def index():
|
159
|
159
|
|
160
|
160
|
# TODO, check if timezone is calculated right
|
161
|
161
|
if 'publishedDate' in result:
|
162
|
|
- if result['publishedDate'] >= datetime.now() - timedelta(days=1):
|
163
|
|
- timedifference = datetime.now() - result['publishedDate']
|
|
162
|
+ if result['publishedDate'].replace(tzinfo=None) >= datetime.now() - timedelta(days=1):
|
|
163
|
+ timedifference = datetime.now() - result['publishedDate'].replace(tzinfo=None)
|
164
|
164
|
minutes = int((timedifference.seconds / 60) % 60)
|
165
|
165
|
hours = int(timedifference.seconds / 60 / 60)
|
166
|
166
|
if hours == 0:
|
|
@@ -168,8 +168,7 @@ def index():
|
168
|
168
|
else:
|
169
|
169
|
result['publishedDate'] = gettext(u'{hours} hour(s), {minutes} minute(s) ago').format(hours=hours, minutes=minutes) # noqa
|
170
|
170
|
else:
|
171
|
|
- # TODO using right timezone
|
172
|
|
- result['pubdate'] = result['publishedDate'].strftime('%a, %d %b %Y %H:%M:%S +0000')
|
|
171
|
+ result['pubdate'] = result['publishedDate'].strftime('%a, %d %b %Y %H:%M:%S %z')
|
173
|
172
|
result['publishedDate'] = format_date(result['publishedDate'])
|
174
|
173
|
|
175
|
174
|
if search.request_data.get('format') == 'json':
|