Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Quick and Dirty show Date from feature
require(["esri/map", "esri/layers/FeatureLayer", "esri/tasks/query"], function (map, FeatureLayer, query) {
var features = [/* assume a list of feature graphics will be assigned here soon */];
// do stuff to assign maps, feature layers, etc.
// do stuff to assign features as a list of search results from a feature layer
var importantDates = features.map(function (feature) {
if (feature.attributes["ImportantDate"] !== null) {
return new Date(feature.attributes["ImportantDate"]);
}
});
var importantDatesAsStrings = importantDates.map(function (dateObj) {
return [
dateObj.getUTCMonth().toString(),
dateObj.getUTCDate().toString(),
dateObj.getUTCFullYear().toString()
].join("/");
});
// do something with the important dates as string.
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment