<?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 Visualize the Points on basis of time difference of 5 minutes in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/visualize-the-points-on-basis-of-time-difference/m-p/1234021#M79404</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Is there anyone who can figure out my mistake ?&lt;/P&gt;&lt;P&gt;I want to to visualize point on map that have the difference of 5 minutes from current time to the time that is mentioned in database.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have mentioned or code the time difference in the arcade expression but unfortunately its not working. Please guide me how can I resolve it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kawish&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;let dates = new Date();

    let lastSevenDays = new Date(dates);
    lastSevenDays.toDateString();
    lastSevenDays.setDate(lastSevenDays.getDate() - 7);

    let year = lastSevenDays.getFullYear();

    let month = (date) =&amp;gt; {
      const m = date.getMonth() + 1;
      if (m.toString().length === 1) {
        return `0${m}`;
      } else {
        return m;
      }
    };
    let date = ("0" + lastSevenDays.getDate()).slice(-2);

    let complete_date = year + "-" + month(lastSevenDays) + "-" + date;

    const name = "$feature.alarmstate";
    const cat = "$feature.category";
    const week = "$feature.lastdowntime";
    const ticketStatus = "$feature.ticketstatus";

    let c_date = new Date();
    let d = new Date(week);

    let diff = c_date.getMinutes() - d.getMinutes();

    if (Math.abs(diff) &amp;lt;= 5)
      console.log(c_date.getMinutes(), d.getMinutes(), "Diff - ", diff);

    let value = 5;

const valueExpression = `When( 
    
${name} == 2 &amp;amp;&amp;amp; ${cat} == 'VIP' &amp;amp;&amp;amp; ${week} &amp;gt;= '${complete_date}', 'two',
    
${name} == 2 &amp;amp;&amp;amp; ${cat} == 'VIP' &amp;amp;&amp;amp; ${week} &amp;lt;= '${complete_date}', 'two_1', 
${name} == 2 &amp;amp;&amp;amp; ${Math.abs(c_date.getMinutes() - new Date(week).getMinutes())
} &amp;lt;= 5, '5Min', 0)`;

    var rendererCheck = {
      type: "unique-value",
      valueExpression: valueExpression,
      uniqueValueInfos: [
        {
          value: "5Min",
          symbol: {
            type: "picture-marker",
            url: "images/down-arrow-red.gif",
            width: "35px",
            height: "40px",
            xoffset: 0,
            yoffset: 12,
          },
        },
        {
          value: "two",
          symbol: {
            type: "picture-marker",
            url: "images/two.png",
            color: "red",
            width: "25px",
            height: "25px",
          },
        },
        {
          value: "two_1",
          symbol: {
            type: "picture-marker",
            url: "images/two_1.png",
            color: "red",
            width: "24px",
            height: "24px",
          },
        },
        {
          value: 0,
          symbol: {
            type: "simple-marker",
            style: "circle",
            color: "white",
            size: "6.5px",
            outline: {
              color: [255, 255, 255, 1],
              width: 0.4,
            },
          },
        },
      ],
    };&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 22 Nov 2022 09:18:54 GMT</pubDate>
    <dc:creator>kawishabbas</dc:creator>
    <dc:date>2022-11-22T09:18:54Z</dc:date>
    <item>
      <title>Visualize the Points on basis of time difference of 5 minutes</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/visualize-the-points-on-basis-of-time-difference/m-p/1234021#M79404</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Is there anyone who can figure out my mistake ?&lt;/P&gt;&lt;P&gt;I want to to visualize point on map that have the difference of 5 minutes from current time to the time that is mentioned in database.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have mentioned or code the time difference in the arcade expression but unfortunately its not working. Please guide me how can I resolve it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kawish&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;let dates = new Date();

    let lastSevenDays = new Date(dates);
    lastSevenDays.toDateString();
    lastSevenDays.setDate(lastSevenDays.getDate() - 7);

    let year = lastSevenDays.getFullYear();

    let month = (date) =&amp;gt; {
      const m = date.getMonth() + 1;
      if (m.toString().length === 1) {
        return `0${m}`;
      } else {
        return m;
      }
    };
    let date = ("0" + lastSevenDays.getDate()).slice(-2);

    let complete_date = year + "-" + month(lastSevenDays) + "-" + date;

    const name = "$feature.alarmstate";
    const cat = "$feature.category";
    const week = "$feature.lastdowntime";
    const ticketStatus = "$feature.ticketstatus";

    let c_date = new Date();
    let d = new Date(week);

    let diff = c_date.getMinutes() - d.getMinutes();

    if (Math.abs(diff) &amp;lt;= 5)
      console.log(c_date.getMinutes(), d.getMinutes(), "Diff - ", diff);

    let value = 5;

const valueExpression = `When( 
    
${name} == 2 &amp;amp;&amp;amp; ${cat} == 'VIP' &amp;amp;&amp;amp; ${week} &amp;gt;= '${complete_date}', 'two',
    
${name} == 2 &amp;amp;&amp;amp; ${cat} == 'VIP' &amp;amp;&amp;amp; ${week} &amp;lt;= '${complete_date}', 'two_1', 
${name} == 2 &amp;amp;&amp;amp; ${Math.abs(c_date.getMinutes() - new Date(week).getMinutes())
} &amp;lt;= 5, '5Min', 0)`;

    var rendererCheck = {
      type: "unique-value",
      valueExpression: valueExpression,
      uniqueValueInfos: [
        {
          value: "5Min",
          symbol: {
            type: "picture-marker",
            url: "images/down-arrow-red.gif",
            width: "35px",
            height: "40px",
            xoffset: 0,
            yoffset: 12,
          },
        },
        {
          value: "two",
          symbol: {
            type: "picture-marker",
            url: "images/two.png",
            color: "red",
            width: "25px",
            height: "25px",
          },
        },
        {
          value: "two_1",
          symbol: {
            type: "picture-marker",
            url: "images/two_1.png",
            color: "red",
            width: "24px",
            height: "24px",
          },
        },
        {
          value: 0,
          symbol: {
            type: "simple-marker",
            style: "circle",
            color: "white",
            size: "6.5px",
            outline: {
              color: [255, 255, 255, 1],
              width: 0.4,
            },
          },
        },
      ],
    };&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2022 09:18:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/visualize-the-points-on-basis-of-time-difference/m-p/1234021#M79404</guid>
      <dc:creator>kawishabbas</dc:creator>
      <dc:date>2022-11-22T09:18:54Z</dc:date>
    </item>
  </channel>
</rss>

