Passing Matrix block to a macro
First, you need to import your macro, and not just call {{ _self.doPeriod() }}. From the documentation:


  When you define a macro in the template where you are going to use it, you might be tempted to call the macro directly via _self.input() instead of importing it; even if seems to work, this is just a side-effect of the current implementation and it won't work anymore in Twig 2.x.


I always do: {% import _self as self %}

slice returns a sequence - in your case an array with one element, and the key is 0. Your macro is expecting a matrix block, not an array, which is why you get that error.

If you only want the first block, then {% set period = timelineText.first %} and period will be a matrix block. {{ self.doPeriod(period) }} will work.

If you want to call doPeriod on all of the matrix blocks, then:

{% for period in timelineText %}
  ... {{ self.doPeriod(period) }} ...
{% endfor %}