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

11 lines
336 B
Smalltalk
Raw Normal View History

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