Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use setTime function #153

Open
lymine1996 opened this issue Jul 24, 2020 · 2 comments
Open

How to use setTime function #153

lymine1996 opened this issue Jul 24, 2020 · 2 comments

Comments

@lymine1996
Copy link

lymine1996 commented Jul 24, 2020

I would like the time slider stops at the position of the last day (showing the most recent map) after refreshing the page. Should I use control.setTime("Date") ? I didn't find the usage of this function in examples given but it appeared in the test file. Somehow it doesn't work in my code. Am I using it in the right way?

    var slider = L.timelineSliderControl({
        formatOutput: function(date){
            return new Date(date).toLocaleDateString();
        },
        steps:150,
        position: 'topleft',
        showTicks: false
    });
    map.addControl(slider);
            
    var illinois_counties_ts = L.timeline(illinois_counties,{style: styleFunc,
        waitToUpdateMap: true, onEachFeature: onEachFeature_illinois_counties});
    slider.setTime("05-05-2020");
    illinois_counties_ts.addTo(map);`
@xiaosuqi1778
Copy link

hi bro,have you resolved this question?i need help,sincrely.

@skeate
Copy link
Owner

skeate commented Feb 8, 2024

setTime takes a number, which would be something like new Date("05-05-2020").getTime()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants