How to focus automatically on the current date in vis.js timeline
<p>I wrote a program that uses vis.js timeline and focuses on the current date on the click of a button:</p>

<p><code>&lt;button type="button" class="btn btn-info" onclick="timeline.focus(0)"&gt;Focus on current date&lt;/button&gt;</code></p>

<p>where</p>

<p><code>var timeline = new vis.Timeline(container, data, options);</code></p>

<p>and</p>

<p><code>var data = [
      //create an item in the dataset corresponding to the current date
    {id: 0, content: 'today', start: Date()},...];</code></p>

<p>Now I would like the timeline to focus automatically on the current date when the user changes its range. I tried to use the <em>rangechange</em> event:</p>

<p><code>timeline.on('rangechange', function (properties) {
            timeline.focus(0);
    });</code>,</p>

<p>but focusing does not occur as expected.</p>

<p>Would you please help me understand what's going on and how I could implement this functionality?</p>