 Issue 29334171:
  Issue 3410 - Added date sort / format for press releases  (Closed)
    
  
    Issue 29334171:
  Issue 3410 - Added date sort / format for press releases  (Closed) 
  | Left: | ||
| Right: | 
| OLD | NEW | 
|---|---|
| (Empty) | |
| 1 | |
| 
saroyanm
2016/02/01 16:24:54
Detail: No new line needed in the beginning of the
 
juliandoucette
2016/02/02 16:44:45
Done.
 | |
| 2 from datetime import datetime | |
| 3 | |
| 4 def humandates(collection, inputFormat='%Y-%m-%d', outputFormat='%B %d, %Y'): | |
| 
saroyanm
2016/02/01 16:24:54
Not really sure if naming this function as human d
 
juliandoucette
2016/02/02 16:44:45
I changed it because it did more than sort.
In th
 | |
| 5 if inputFormat != outputFormat: | |
| 
Sebastian Noack
2016/02/01 18:01:22
This check is redundant. No need for premature mic
 
juliandoucette
2016/02/02 16:44:45
Done.
 | |
| 6 for item in collection: | |
| 7 item[0] = datetime.strftime(datetime.strptime(item[0], inputFormat), outpu tFormat) | |
| 
Sebastian Noack
2016/02/01 18:01:23
A filter changing it's input in-place is quite une
 
juliandoucette
2016/02/02 16:44:45
I agree. In the next patch I will manipulate a cop
 | |
| 8 return sorted(collection, reverse=True, key=lambda date: datetime.strptime(dat e[0], outputFormat)) | |
| OLD | NEW |