Am 23.11.2014 um 14:18 schrieb Mark Bestley <st@bestley.co.uk>:
On 22/11/2014 11:03, Hilaire wrote:
I saw some discussion about Duration and year calculus in the list
Given that it is impossible to determine the number of days in a year without the calendar years, should not 365.25 be used in place of 365 to minimize the error ?
So it could look like:
Duration class >> years: aNumber ^ self days: (aNumber * 365.25) truncated seconds: 0
I think it depends :)
What use do you want to make of the answer.
If for loan, bank or mortgage calculations then you need the days and adjustments and other info.
If for tens of years it might work
If to know the number of days it needs to be an integer.
There is no one correct solution
Would you really define such a fundamental thing after any use case? After all it is about the duration and 365.25 is more accurate. The duration doesn't make assumptions about a unit of measurement. If you the duration in days you should use aYear daysInYear Norbert