heremaps / maps-api-for-javascript-examples

Self-contained examples for Maps API for JavaScript v3.
https://developer.here.com/javascript-apis/documentation/v3/maps
Other
202 stars 431 forks source link

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

Closed sestienne closed 11 months ago

sestienne commented 3 years ago

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 commented 2 years ago

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.