socib / Leaflet.TimeDimension

Add time dimension capabilities on a Leaflet map.
MIT License
435 stars 139 forks source link

Can the `displayDate` be formatted? #145

Closed carlostighe closed 6 years ago

carlostighe commented 6 years ago

Im wondering can the displayDate be formatted? screenshot from 2018-03-29 17-00-21

pazrg commented 6 years ago

Hi @Craicerjack; Sorry to reply this late! There are several ways to get what you want; here you can find at least 2 examples on our demos: example 11 example 12

All of them extend L.Control.TimeDimension i.e as follows: L.Control.TimeDimensionCustom = L.Control.TimeDimension.extend({ _getDisplayDateFormat: function(date){ return date.format("mmmm yyyy"); } });

Hope this help! Let us know from you!

carlostighe commented 6 years ago

@pazrg Thanks. Yeah I figured it out. Apologies I should have closed the issue.

As above I did

L.Control.TimeDimensionCustom = L.Control.TimeDimension.extend({
    _getDisplayDateFormat: function(date){
        return date.format("ddd - HH:MM");
    }
});
ErikaHD commented 6 years ago

Hi Craicerjack, Could you tell me how you solve your issue? I am having the same problem. Thanks