Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: filters/datesort.py

Issue 29334171: Issue 3410 - Added date sort / format for press releases (Closed)
Left Patch Set: Created Jan. 20, 2016, 4:58 p.m.
Right Patch Set: Fixed datetime call Created Feb. 9, 2016, 4 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | filters/humanize_date.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 1 def datesort(collection):
2 from datetime import datetime 2 return sorted(collection, reverse=True)
3
4 def datesort(collection, inputFormat='%Y-%m-%d', outputFormat='%B %d, %Y'):
5 if inputFormat != outputFormat:
6 for item in collection:
7 item[0] = datetime.strftime(datetime.strptime(item[0], inputFormat), outpu tFormat)
8 return sorted(collection, key=lambda date: datetime.strptime(date[0], outputFo rmat))
saroyanm 2016/01/22 11:58:14 The items need to be sorted in descending order
juliandoucette 2016/01/25 16:19:55 Done.
LEFTRIGHT

Powered by Google App Engine
This is Rietveld