LeafletSlider icon indicating copy to clipboard operation
LeafletSlider copied to clipboard

Timestamp is not shown at first

Open hashemian opened this issue 9 years ago • 3 comments

Hi there

When you set showAllOnStart and alwaysShowDate, at the beginning the timestamp is not shown under the slider, until the slider is moved for the first time. This is because at the beginning, setting the timestamp is through the following code:

if (!_options.range && _options.alwaysShowDate) {
    $('#slider-timestamp').html(_extractTimeStamp(_options.markers[index_start].feature.properties[_options.timeAttribute], _options));
}

And this code does not consider the cases where markers don't have feature, unlike the code which is responsible for showing the timestamp when the slider is moved.

To fix this, I simply had to move the code used to set the timestamp in the slide function into a separate function, and then call it both from inside of the if statement above, and also from inside the slide function, and that fixed the issue, but I could not upload a patch/pull request for this issue.

Any idea how I can get this fixed? In case someone else wants to use this as well in future?

Cheers, M.

hashemian avatar Oct 07 '15 00:10 hashemian

Why couldn't you upload a patch?

dwilhelm89 avatar Oct 07 '15 17:10 dwilhelm89

Thank you very much! I would like to fix it on my map as well but I am not savvy enough with coding to fix it myself with your instruction. Please upload a patch.

imlearningr avatar Jun 16 '16 15:06 imlearningr

Hi, did anybody fix this?

milas991 avatar Feb 03 '19 19:02 milas991