AnsweredAssumed Answered

How can I format a date within a InfoWindow for a Graphics Layer?

Question asked by craigpatterson on Jul 28, 2016
Latest reply on Jul 28, 2016 by rscheitlin

I have a GraphicLayer that I build using a QueryTask. One of the attributes is a date field. When the InfoWindow for this layer is rendered, it displays the date in Epoch or Unix format, IE, -297512519. I've tried various solutions for formatting the date in the InfoTemplate. Here are a couple of them:

 

${PRINT_DATE:DateFormat(selector:'date')}

 

${PRINT_DATE:DateFormat(datePattern:'MM/dd/yyyy.', selector:'date')}

 

With a custom function. This works in formatting my DataGrid. I've tried to embed this inline into the InfoTemplate

${PRINT_DATE:formatDate}

 

function formatDate(datum){

     if (datum){

          var d = new Date(datum);

          return dojo.date.format(d, {

               selector:'date',

               datePattern: 'MM/dd/yyyy'

          }

     }

     return;

}

 

Any suggestions?

 

Thanks,

 

Craig

Outcomes