Commit 99fd8af8 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Use truncated division.

(Implicit in Python 2, has to be made explicit with // in Python 3).
parent 8542cffd
...@@ -29,7 +29,7 @@ def _add_months(p_sourcedate, p_months): ...@@ -29,7 +29,7 @@ def _add_months(p_sourcedate, p_months):
https://stackoverflow.com/questions/4130922/how-to-increment-datetime-month-in-python https://stackoverflow.com/questions/4130922/how-to-increment-datetime-month-in-python
""" """
month = p_sourcedate.month - 1 + p_months month = p_sourcedate.month - 1 + p_months
year = p_sourcedate.year + month / 12 year = p_sourcedate.year + month // 12
month = month % 12 + 1 month = month % 12 + 1
day = min(p_sourcedate.day, calendar.monthrange(year, month)[1]) day = min(p_sourcedate.day, calendar.monthrange(year, month)[1])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment