Socialmetrica/Socialmetrica.package/Integer.extension/instance/periodsSince.until..st

11 lines
336 B
Smalltalk

*Socialmetrica
periodsSince: startingDate until: endingDate
| endings subperiodDuration |
subperiodDuration := (endingDate - startingDate) / self.
endings := OrderedCollection new.
endings add: startingDate.
1 to: self do: [ :i | | ending |
ending := startingDate + (subperiodDuration * i).
endings add: ending.
].
^ endings