<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Feature not being created due to date field type in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-not-being-created-due-to-date-field-type/m-p/1202728#M78285</link>
    <description>&lt;P&gt;See that's how i started with initially, passing the date format, but for some reason it is not accepted by argcis. Only epoch number is accepted.&lt;/P&gt;</description>
    <pubDate>Mon, 15 Aug 2022 06:07:09 GMT</pubDate>
    <dc:creator>Aeseir</dc:creator>
    <dc:date>2022-08-15T06:07:09Z</dc:date>
    <item>
      <title>Feature not being created due to date field type</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-not-being-created-due-to-date-field-type/m-p/1202271#M78264</link>
      <description>&lt;P&gt;Very simply I am trying to enrich a feature on creation by adding a createdAt datetime. However when I add this additional attribute, the feature does not get created.&lt;/P&gt;&lt;P&gt;I am learning how to add this attribute so that in future I can filter features by date and/or create heatmaps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code is very simple:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;//feature layer setup
 const featureLayer = new FeatureLayer({
      geometryType: "polygon",
      title: "Test Feature Layer",
      source: [],
      objectIdField: "UniqueId",
      spatialReference: {
        wkid: 102100
      },
      fields: [{
        name: "id",
        alias: "UniqueId",
        type: "guid"
      }, {
        name: "description",
        alias: "Description",
        type: "string"
      }, {
        name: "createdDate",
        alias: "CreatedDate",
        type: "date"
      }],
      outFields: ["*"],
      popupTemplate: popupTemplateDetails,
    });

// adding feature
var polygon = this.addPolygonGraphic({ id: e.id, description: e.description, createdDate: new Date(2019, 4, 25) }, rings);

this.areaFeatureLayer.applyEdits({ addFeatures: polygonFeatures });


function addPolygonGraphic(attributes: { [key: string]: any }, rings: any) {
    var polygon = new Polygon({
      rings: rings,
      spatialReference: {
        wkid: 102100
      }
    });

    var graphic = new Graphic({
      geometry: polygon,
      attributes: attributes
    });
    return graphic;
  }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am I missing here?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 04:23:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-not-being-created-due-to-date-field-type/m-p/1202271#M78264</guid>
      <dc:creator>Aeseir</dc:creator>
      <dc:date>2022-08-12T04:23:30Z</dc:date>
    </item>
    <item>
      <title>Re: Feature not being created due to date field type</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-not-being-created-due-to-date-field-type/m-p/1202285#M78265</link>
      <description>&lt;P&gt;I don't know about the Javascript API, but in Arcade (which seems to share a big part of the feature set declaration with the JS API), you have to supply an integer (epoch, number of milliseconds since 1970-01-01) to the date field.&lt;/P&gt;&lt;P&gt;This is how it would look in Arcade:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Number(Date(2019, 4, 25))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 06:27:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-not-being-created-due-to-date-field-type/m-p/1202285#M78265</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-08-12T06:27:46Z</dc:date>
    </item>
    <item>
      <title>Re: Feature not being created due to date field type</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-not-being-created-due-to-date-field-type/m-p/1202287#M78266</link>
      <description>&lt;P&gt;That was it, i had to convert it to number, which is annoying&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 06:45:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-not-being-created-due-to-date-field-type/m-p/1202287#M78266</guid>
      <dc:creator>Aeseir</dc:creator>
      <dc:date>2022-08-12T06:45:13Z</dc:date>
    </item>
    <item>
      <title>Re: Feature not being created due to date field type</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-not-being-created-due-to-date-field-type/m-p/1202653#M78279</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;&amp;nbsp;how do you manage the time offset due to timezones, epoch ignores timezones&lt;/P&gt;</description>
      <pubDate>Sun, 14 Aug 2022 06:22:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-not-being-created-due-to-date-field-type/m-p/1202653#M78279</guid>
      <dc:creator>Aeseir</dc:creator>
      <dc:date>2022-08-14T06:22:17Z</dc:date>
    </item>
    <item>
      <title>Re: Feature not being created due to date field type</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-not-being-created-due-to-date-field-type/m-p/1202727#M78284</link>
      <description>&lt;P&gt;Again, no idea how to do it in the JS API.&lt;/P&gt;&lt;P&gt;Arcade has the functions &lt;A href="https://developers.arcgis.com/arcade/function-reference/date_functions/#toutc" target="_blank" rel="noopener"&gt;ToUTC()&lt;/A&gt; and &lt;A href="https://developers.arcgis.com/arcade/function-reference/date_functions/#tolocal" target="_blank" rel="noopener"&gt;ToLocal()&lt;/A&gt;, which convert your local date to UTC or vice versa.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_0-1660542054906.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/48603i902812A4216CE75E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohannesLindner_0-1660542054906.png" alt="JohannesLindner_0-1660542054906.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Aug 2022 05:41:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-not-being-created-due-to-date-field-type/m-p/1202727#M78284</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-08-15T05:41:32Z</dc:date>
    </item>
    <item>
      <title>Re: Feature not being created due to date field type</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-not-being-created-due-to-date-field-type/m-p/1202728#M78285</link>
      <description>&lt;P&gt;See that's how i started with initially, passing the date format, but for some reason it is not accepted by argcis. Only epoch number is accepted.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Aug 2022 06:07:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-not-being-created-due-to-date-field-type/m-p/1202728#M78285</guid>
      <dc:creator>Aeseir</dc:creator>
      <dc:date>2022-08-15T06:07:09Z</dc:date>
    </item>
    <item>
      <title>Re: Feature not being created due to date field type</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-not-being-created-due-to-date-field-type/m-p/1299935#M81413</link>
      <description>&lt;P&gt;With this week's update to Arcade and ArcGIS Dashboards, date fields in feature set constructors now just work. You no longer have to wrap dates with&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Number()&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;if you pass the &lt;EM&gt;dictionary&lt;/EM&gt; into the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;FeatureSet()&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;function (which as of this release accepts a dictionary as opposed to only text based JSON).&lt;/P&gt;&lt;P&gt;Instead of:&lt;/P&gt;&lt;PRE&gt;return FeatureSet(Text(dict))&lt;/PRE&gt;&lt;P&gt;Do this:&lt;/P&gt;&lt;PRE&gt;return FeatureSet(dict)&lt;/PRE&gt;&lt;P&gt;Learn more in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.esri.com/t5/arcgis-dashboards-blog/dashboard-data-expressions-what-has-changed-june/ba-p/1298782" target="_blank" rel="noopener"&gt;this blog post&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;NOTE: For Enterprise users, this update is targeted for 11.2&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 19:26:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-not-being-created-due-to-date-field-type/m-p/1299935#M81413</guid>
      <dc:creator>DavidNyenhuis1</dc:creator>
      <dc:date>2023-06-15T19:26:46Z</dc:date>
    </item>
  </channel>
</rss>

