<?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 ClosestFacilityTask sends the timeOfDay parameter as a string of Date format instead of an epoch format to the server.  in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/closestfacilitytask-sends-the-timeofday-parameter/m-p/712566#M66229</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have discovered bug with the ArcGIS API for JavaScript, which affects ClosestFacility calls: “timeOfDay” values are incorrectly sent to the server as a string of the date, i.e. timeOfDay: “2019-08-19T23:45:00.000Z”, however testing using the endpoint reveals it &lt;STRONG&gt;should&lt;/STRONG&gt; be sent in a milliseconds since epoch (Unix) format, i.e. timeOfDay: 1566258300000. This causes the server to resort to some kind of default time, so that the wrong result is returned… Route task (I have not tested others) does correctly send the routing time parameter (&lt;STRONG&gt;startTime&lt;/STRONG&gt;) in Unix format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To confirm the issue:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;specify a &lt;STRONG&gt;timeOfDay&lt;/STRONG&gt;, &lt;STRONG&gt;timeOfDayUsage&lt;/STRONG&gt; and &lt;STRONG&gt;travelDirection&lt;/STRONG&gt; in Closest Facility Parameters&lt;/LI&gt;&lt;LI&gt;open browser developer tools to Network tab&lt;/LI&gt;&lt;LI&gt;send request, receive response&lt;/LI&gt;&lt;LI&gt;review corresponding startTime/endTime in response - it will have defaulted to some time like 8AM today (seems to vary), which is &lt;STRONG&gt;not the requested time&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;compare this behaviour to Routing requests (&lt;STRONG&gt;startTime&lt;/STRONG&gt; parameter)&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a Codepen demonstrating the above: &lt;A href="https://codepen.io/stacy-rendall/pen/qBWZQJr"&gt;https://codepen.io/stacy-rendall/pen/qBWZQJr&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For some unknown reason Esri have noted this bug, but closed the issue claiming that it is "by design" (&lt;A class="link-titled" href="https://support.esri.com/en/bugs/nimbus/QlVHLTAwMDEyNDY5MQ==" title="https://support.esri.com/en/bugs/nimbus/QlVHLTAwMDEyNDY5MQ=="&gt;BUG-000124691: ClosestFacilityTask sends the timeOfDay parameter as..&lt;/A&gt;&amp;nbsp;), this makes no sense - the bug causes the server to ignore the specified "timeOfDay", there is no way that could be "by design".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have implemented a pretty rough workaround (calling the server directly using "esri/request") that I can share if it is useful to anyone (Esri devs?).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 14 Oct 2019 19:56:49 GMT</pubDate>
    <dc:creator>Stacy-Rendall</dc:creator>
    <dc:date>2019-10-14T19:56:49Z</dc:date>
    <item>
      <title>ClosestFacilityTask sends the timeOfDay parameter as a string of Date format instead of an epoch format to the server.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/closestfacilitytask-sends-the-timeofday-parameter/m-p/712566#M66229</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have discovered bug with the ArcGIS API for JavaScript, which affects ClosestFacility calls: “timeOfDay” values are incorrectly sent to the server as a string of the date, i.e. timeOfDay: “2019-08-19T23:45:00.000Z”, however testing using the endpoint reveals it &lt;STRONG&gt;should&lt;/STRONG&gt; be sent in a milliseconds since epoch (Unix) format, i.e. timeOfDay: 1566258300000. This causes the server to resort to some kind of default time, so that the wrong result is returned… Route task (I have not tested others) does correctly send the routing time parameter (&lt;STRONG&gt;startTime&lt;/STRONG&gt;) in Unix format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To confirm the issue:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;specify a &lt;STRONG&gt;timeOfDay&lt;/STRONG&gt;, &lt;STRONG&gt;timeOfDayUsage&lt;/STRONG&gt; and &lt;STRONG&gt;travelDirection&lt;/STRONG&gt; in Closest Facility Parameters&lt;/LI&gt;&lt;LI&gt;open browser developer tools to Network tab&lt;/LI&gt;&lt;LI&gt;send request, receive response&lt;/LI&gt;&lt;LI&gt;review corresponding startTime/endTime in response - it will have defaulted to some time like 8AM today (seems to vary), which is &lt;STRONG&gt;not the requested time&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;compare this behaviour to Routing requests (&lt;STRONG&gt;startTime&lt;/STRONG&gt; parameter)&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a Codepen demonstrating the above: &lt;A href="https://codepen.io/stacy-rendall/pen/qBWZQJr"&gt;https://codepen.io/stacy-rendall/pen/qBWZQJr&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For some unknown reason Esri have noted this bug, but closed the issue claiming that it is "by design" (&lt;A class="link-titled" href="https://support.esri.com/en/bugs/nimbus/QlVHLTAwMDEyNDY5MQ==" title="https://support.esri.com/en/bugs/nimbus/QlVHLTAwMDEyNDY5MQ=="&gt;BUG-000124691: ClosestFacilityTask sends the timeOfDay parameter as..&lt;/A&gt;&amp;nbsp;), this makes no sense - the bug causes the server to ignore the specified "timeOfDay", there is no way that could be "by design".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have implemented a pretty rough workaround (calling the server directly using "esri/request") that I can share if it is useful to anyone (Esri devs?).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Oct 2019 19:56:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/closestfacilitytask-sends-the-timeofday-parameter/m-p/712566#M66229</guid>
      <dc:creator>Stacy-Rendall</dc:creator>
      <dc:date>2019-10-14T19:56:49Z</dc:date>
    </item>
  </channel>
</rss>

