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

11 lines
336 B
Smalltalk

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