If the calculated originPosition is not zero the timestamps of periods are incorrect.
This is because the originPosition is not added in the periodPosition (wasn't a problem if originPosition was zero!)
To fix this we should update getPeriodPosition so that Math.floor((position - originPosition) / interval) * interval is replaced with Math.floor((position - originPosition) / interval) * interval + originPosition
Bug
Current Behavior
If the calculated originPosition is not zero the timestamps of periods are incorrect.
This is because the originPosition is not added in the periodPosition (wasn't a problem if originPosition was zero!)
To fix this we should update
getPeriodPosition
so thatMath.floor((position - originPosition) / interval) * interval
is replaced withMath.floor((position - originPosition) / interval) * interval + originPosition