I have a web map in AGOL where the date attribute is set to display at DD/MM/YYYY. When I test this in AGOL it works fine. However when I use the JS API V4.12 to embed the web map onto my website it reverts to the default date format, MM/DD/YYYY.
See attached.
Does the popup date format need to be forced to DD/MM/YYYY in the embedded map using JS, if so how is this achieved?
Many thanks.
I think as a community we need to have something like this idea
ESRI default date JSON display format across entire suite of platforms
Thanks all,
I made some headway with this approach:<script> // set locale before JSAPI is loaded dojoConfig = { locale: "ja", parseOnLoad: true }; </script>insofar as the date format changed... but I couldn't get the proper date DD/MM/YYYY to display.
In the end I reverted to one of the other date options in the web map "December 21 1997" and that sufficed.It's a confusing one as it doesn't seem easy to trace to an exact cause.Thanks for your help.
Formatting the popup content is a good idea.
Another thought is that it looks like you might have specified some localization in Portal/AGO? I believe this would account for the DD/MM/YYYY format. Either that or AGO is smart enough to recognize the date format of the region you are connecting from.
Set language and region—ArcGIS Online Help | ArcGIS
In the JS API app, you could try using the English (en) locale to see if the European date format persists
Localization | ArcGIS API for JavaScript 4.12
Lastly, you could construct an arcade expression in the popup to display the date in a logical format.
Date Functions | ArcGIS for Developers
You can use a Popup Template: PopupTemplate | ArcGIS API for JavaScript 4.12
To specify a date format: FieldInfoFormat | ArcGIS API for JavaScript 4.12
Here is an example of how to create and use a popup template: ArcGIS API for JavaScript Sandbox
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.