Skip to content

Instantly share code, notes, and snippets.

@raykendo
Created March 30, 2016 17:17
Show Gist options
  • Save raykendo/571faeee879d8959ed0f07bc56531e83 to your computer and use it in GitHub Desktop.
Save raykendo/571faeee879d8959ed0f07bc56531e83 to your computer and use it in GitHub Desktop.
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