When timeline is a TimelineView, timeline.val() is supposed to return the visible time range in the view. However, it only behaves as expected when the user has already zoomed in or out on a selection in the timeline. Otherwise (when the range is selected automatically from a search) it returns undefined.
A workaround I found was to use the first and last events of the search data to arrive at the right value. However, this doesn't work when there are more than 100 events, because the results are limited to 100.
What is the right way to get the initial time range of a timeline after a search?