We are using the Park and Recreation Locator from ArcGIS for State Government and trying to put a date field into the popup info window. The field is pulling the correct data, but it's formatting it as a number (JavaScript milliseconds) instead of a date. There is a variable in the config.js file called FormatDateAs which has been set as a date according to ESRI's site "MMM dd, yyyy", but has no discernible effect. From experience with some of ESRI's other templates, I tried adding in fields to the InfoPopupFieldsCollection such as isDate or variations on Format but none worked. ESRI's site has no additional documentation for formatting a date in this template.

We need the field to remain a date type in the database for future changes we have planned, so simply changing the fields to strings containing the pre-formatted dates won't work. Does anyone know how we can get this field to format correctly in the code?


You can set the formatting for the date attributes in your template using the built in support. The format is ${FIELD_NAME:FORMAT_FUNCTION_NAME(OPTION_A: value, OPTION_B: value)}. So for dates you can use something like ${DATE:DateFormat} or ${DATE:DateString}. There are more options documented at the format info window help page. Hopefully you can find the correct place in the config to edit and get this to work.

  • This looked so promising, but unfortunately doesn't work. The DateFormat and DateString options alone cause it to return an error message, and including the optional parameters makes the template interpret the whole thing as a string, not a variable. – techturtle Jul 29 '14 at 18:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.