maps-api-for-javascript-examples icon indicating copy to clipboard operation
maps-api-for-javascript-examples copied to clipboard

HERE Maps API JS : How to change the date format in incident popup?

Open sestienne opened this issue 2 years ago • 1 comments

Hi, Even if layers and UI have been created with french language : var defaultLayers = platform.createDefaultLayers({lg : 'fre'}); var ui = H.ui.UI.createDefault(map, defaultLayers,'fr-FR');

dates in layer incidents on popup are displayed in english format : It's like mm/dd/yyyy and I would like dd/mm/yyyy

How can I do it with here api javascript 3 ? Thanks

image

sestienne avatar Nov 23 '21 16:11 sestienne

Here support respond to me and we success to integrate it : I'm afraid the default Traffic Incidents Layer generated by the Javascript API does not allow any options for changing the date format in the incidents. The workaround for this is for you to implement your own Incidents layer by calling the Traffic API directly and then format the dates returned by service using code. In that way, the dates could have any format you want, not just a predefined one.

Here's the link to an example (https://tcs.ext.here.com/examples/v3.1/traffic_viewer) created by HERE with a custom implementation of the incidents layer which might be helpful; the code is exposed so you can take a look and see how it was done.

sestienne avatar Jan 24 '22 17:01 sestienne