AnsweredAssumed Answered

ESRI Popup Date

Question asked by alex.gole_ELDORADOCOUNTY on Feb 15, 2017
Latest reply on Feb 17, 2017 by ajbooter

Hi all,

I am creating a popup programmatically and it works fine but I am not sure how to not return the default computer date value of "december 31st 1969" when date is empty. I started with an if statement line 7 but not too sure how to return a "No Value" if no date value in th epopup. Any idea?

 

function getTextContent(graphic) {
          var phone = graphic.attributes.Public_Contact;
          var rs = graphic.attributes.BLOCKNM;
          var comment = graphic.attributes.COMMENT;
          var fc = graphic.attributes.FULLCLOSE;
          var Loc = graphic.attributes.LOCDESC;
          if(graphic.attributes.Estimated_End == "") {
             content += "<br/><b>No Value</b>"; 
           }
          var lastupdated = locale.format(new Date(graphic.attributes.LASTUPDATE), {
              selector: 'date',
              datePattern: 'MMMM d, y',
              time: "h:m:s.SSS a z",
           });
           var eed = locale.format(new Date(graphic.attributes.Estimated_End), {
              selector: 'date',
              datePattern: 'MMMM d, y'
           });
           var starts = locale.format(new Date(graphic.attributes.STARTDATE), {
              selector: 'date',
              datePattern: 'MMMM d, y'
           });
          return "<b>Road Status: </b>" + rs + "<br>" +
          "<b>Comments: </b>" + comment + "<br>" +
          "<b>Full Closure: </b>" + fc + "<br>" +
          "<b>Location: </b>" + Loc + "<br>" +
          "<b>Starts: </b>" + starts + "<br>" +
          "<b>Estimated End Date: </b>" + eed + "<br>" +
          "<b>Public Contact Information: </b>" + "<a href=tel:" + phone + ">" + phone + "</a><br>" +
          "<b>Last Updated: </b>" + lastupdated + "<br>"
          }

Outcomes