<?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 Arcade Style Expression to filter by date in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/arcade-style-expression-to-filter-by-date/m-p/1339032#M55148</link>
    <description>&lt;P&gt;I'm trying to filter out events in my Feature Layer by dates. I am doing this in the ArcGIS Online Map Viewer Style expressions. It works otherwise fine, but this script won't show events that are happening today as Active:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var start = $feature.start;
var end = $feature.end;
var today = Now();

var event = When(
  end &amp;gt;= today &amp;amp;&amp;amp; start &amp;lt;= today, 'Active', 'Upcoming'
);

return event;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The dates are in Esri Datetime format:&lt;/DIV&gt;&lt;DIV&gt;start = 10/18/2023 3:00 am.&lt;/DIV&gt;&lt;DIV&gt;end = 10/18/2023 3:00 am.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;It also doesn't show event that start today and end another day:&lt;/DIV&gt;&lt;DIV&gt;start = 10/18/2023 3:00 am.&lt;/DIV&gt;&lt;DIV&gt;end = 10/19/2023 3:00 am.&lt;/DIV&gt;</description>
    <pubDate>Wed, 18 Oct 2023 11:44:06 GMT</pubDate>
    <dc:creator>NygrenOhto</dc:creator>
    <dc:date>2023-10-18T11:44:06Z</dc:date>
    <item>
      <title>Arcade Style Expression to filter by date</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-style-expression-to-filter-by-date/m-p/1339032#M55148</link>
      <description>&lt;P&gt;I'm trying to filter out events in my Feature Layer by dates. I am doing this in the ArcGIS Online Map Viewer Style expressions. It works otherwise fine, but this script won't show events that are happening today as Active:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var start = $feature.start;
var end = $feature.end;
var today = Now();

var event = When(
  end &amp;gt;= today &amp;amp;&amp;amp; start &amp;lt;= today, 'Active', 'Upcoming'
);

return event;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The dates are in Esri Datetime format:&lt;/DIV&gt;&lt;DIV&gt;start = 10/18/2023 3:00 am.&lt;/DIV&gt;&lt;DIV&gt;end = 10/18/2023 3:00 am.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;It also doesn't show event that start today and end another day:&lt;/DIV&gt;&lt;DIV&gt;start = 10/18/2023 3:00 am.&lt;/DIV&gt;&lt;DIV&gt;end = 10/19/2023 3:00 am.&lt;/DIV&gt;</description>
      <pubDate>Wed, 18 Oct 2023 11:44:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-style-expression-to-filter-by-date/m-p/1339032#M55148</guid>
      <dc:creator>NygrenOhto</dc:creator>
      <dc:date>2023-10-18T11:44:06Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Style Expression to filter by date</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-style-expression-to-filter-by-date/m-p/1339071#M55151</link>
      <description>&lt;P&gt;I managed to fix this myself by changing the start to this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var alku = Date(Year($feature.alkaa), Month($feature.alkaa), Day($feature.alkaa), 0, 0, 0, 0);&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;The problem was that AGOL changed the time to datetime and added the default time to the date.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 12:33:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-style-expression-to-filter-by-date/m-p/1339071#M55151</guid>
      <dc:creator>NygrenOhto</dc:creator>
      <dc:date>2023-10-18T12:33:00Z</dc:date>
    </item>
  </channel>
</rss>

