Skip to content

Commit

Permalink
Force the day when getting the previous files to avoid issues when th…
Browse files Browse the repository at this point in the history
…e previous month has less day than the current
  • Loading branch information
krtek4 committed Jul 31, 2014
1 parent 88d703c commit 09ce761
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions taxi/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,15 @@ def get_files(self, filename, nb_previous_files):

if smallest_unit == 'm':
if file_date.month == 1:
file_date = file_date.replace(month=12,
file_date = file_date.replace(day=1,
month=12,
year=file_date.year - 1)
else:
file_date = file_date.replace(month=file_date.month - 1)
file_date = file_date.replace(day=1,
month=file_date.month - 1)

elif smallest_unit == 'Y':
file_date = file_date.replace(year=file_date.year - 1)
file_date = file_date.replace(day=1, year=file_date.year - 1)

return files

Expand Down

0 comments on commit 09ce761

Please sign in to comment.