Changes between Initial Version and Version 1 of Ticket #19210, comment 18
- Timestamp:
- Jun 4, 2015, 5:52:38 PM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #19210, comment 18
initial v1 1 After looking into a lot of algorithms for date diffing, including the ones suggested above and the ones from `python-dateutil` (which get pretty complex) I decided to go for the most simple solution I could find. I assume `timesince` wasn't ever meant to be an calculation. If we would want an exact calculation, we should completely re-implement it to correctly work with the different number of days in the months and so on.1 After looking into a lot of algorithms for date diffing, including the ones suggested above and the ones from `python-dateutil` (which get pretty complex) I decided to go for the most simple solution I could find. I assume `timesince` wasn't ever meant to be an exact calculation. If we would want an exact calculation, we should completely re-implement it to correctly work with the different number of days in the months and so on. 2 2 3 3 However, there is a very simple fix to the accumulated error that grows with the given time period: just use `calendar.leapdays` from the standard library and substract it from the number of days.