<?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: Arcade expression for date ranges in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/arcade-expression-for-date-ranges/m-p/1002650#M5675</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1371"&gt;@JoshuaBixby&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;You're not the only one that has made mistakes with this zero index month weirdness that is part of JavaScript. I have been there as well (and more than once...).&lt;/P&gt;</description>
    <pubDate>Wed, 18 Nov 2020 18:46:23 GMT</pubDate>
    <dc:creator>XanderBakker</dc:creator>
    <dc:date>2020-11-18T18:46:23Z</dc:date>
    <item>
      <title>Arcade expression for date ranges</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-expression-for-date-ranges/m-p/1001275#M5656</link>
      <description>&lt;P&gt;can some one help me correct the expression for the maintenance done in different date ranges&lt;/P&gt;&lt;P&gt;example:&lt;/P&gt;&lt;P&gt;var daterange = date(2020,1)&amp;lt;(2020,7)&lt;BR /&gt;var daterange1 = date(2020,8)&amp;lt;(2020,12)&lt;BR /&gt;var maint =DomainName($feature,"MAINTENANCE_TYPE") &lt;STRONG&gt;(it has 3 domains as regular, non-scheduled, and emergency)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;if (maint=daterange) {&lt;BR /&gt;return "Spring-Summer";&lt;BR /&gt;if (maint=daterange1){&lt;BR /&gt;return "Fall-Winter";&lt;BR /&gt;} else {&lt;BR /&gt;return "Other"&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Nov 2020 17:11:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-expression-for-date-ranges/m-p/1001275#M5656</guid>
      <dc:creator>KhemAryal</dc:creator>
      <dc:date>2020-11-13T17:11:23Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression for date ranges</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-expression-for-date-ranges/m-p/1001314#M5657</link>
      <description>&lt;P&gt;There are several things to comment on, but I don't have time to hit on them all now, so I will touch on the biggest.&lt;/P&gt;&lt;P&gt;First, you are making bad Date function calls.&amp;nbsp; You have to specify a day as well, i.e., Date(2020,1,1).&amp;nbsp; Second, the way you are trying to define a date range is not correct.&amp;nbsp; If your Date function calls were correct, what you would be storing in daterange and daterange1 is not a date range but a boolean true value because January is less than July.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Nov 2020 18:39:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-expression-for-date-ranges/m-p/1001314#M5657</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-11-13T18:39:48Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression for date ranges</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-expression-for-date-ranges/m-p/1001317#M5659</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi, thanks for the information,&lt;/P&gt;&lt;P&gt;I am very new to arcade and trying to learn stuff here. In my example, I have &lt;STRONG&gt;Date&lt;/STRONG&gt; field and &lt;STRONG&gt;Maintenance&lt;/STRONG&gt; Field (with three domains regular, non-schedule, emergency)&lt;/P&gt;&lt;P&gt;I am trying to show in symbol with arcade expression&lt;/P&gt;&lt;P&gt;&lt;U&gt;emergency maintenance done between &lt;/U&gt;&lt;/P&gt;&lt;P&gt;January to July as Emergency Spring&lt;/P&gt;&lt;P&gt;August to December as Emergency "fall"&lt;/P&gt;&lt;P&gt;&lt;U&gt;regular maintenance done between&lt;/U&gt;&lt;/P&gt;&lt;P&gt;January to July as Regular Spring&lt;/P&gt;&lt;P&gt;August to December as Regular "fall"&lt;/P&gt;&lt;P&gt;&lt;U&gt;non-schedule maintenance done between&lt;/U&gt;&lt;/P&gt;&lt;P&gt;January to July as non-schedule Spring&lt;/P&gt;&lt;P&gt;August to December as non-schedule "fall"&lt;/P&gt;</description>
      <pubDate>Fri, 13 Nov 2020 18:41:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-expression-for-date-ranges/m-p/1001317#M5659</guid>
      <dc:creator>KhemAryal</dc:creator>
      <dc:date>2020-11-13T18:41:22Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression for date ranges</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-expression-for-date-ranges/m-p/1001357#M5660</link>
      <description>&lt;P&gt;The following structure should work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;IIf(Month(maint_date) &amp;lt; 8, "spring", "fall")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Nov 2020 19:37:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-expression-for-date-ranges/m-p/1001357#M5660</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-11-13T19:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression for date ranges</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-expression-for-date-ranges/m-p/1002568#M5671</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/150120"&gt;@KhemAryal&lt;/a&gt;&amp;nbsp; and&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1371"&gt;@JoshuaBixby&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See the example below:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// change the name of the field
var datemonth = Month($feature["Name of the Date Field"]); 
var maint = Proper(DomainName($feature,"MAINTENANCE_TYPE"), "firstword");

if (datemonth &amp;lt; 7) {
    return maint + " Spring";
} else {
    return maint + " Fall";
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that the month value is a value from 0 to 11 and not 1 to 12. So spring (including July) should be a value &amp;lt; 7.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2020 15:52:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-expression-for-date-ranges/m-p/1002568#M5671</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2020-11-18T15:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression for date ranges</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-expression-for-date-ranges/m-p/1002572#M5672</link>
      <description>&lt;P&gt;Xander, regarding the month cut off, I was assuming the OP didn't want a 6/6 split but a 7/5 split for defining seasons given what he wrote in response to my first reply.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2020 16:13:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-expression-for-date-ranges/m-p/1002572#M5672</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-11-18T16:13:45Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression for date ranges</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-expression-for-date-ranges/m-p/1002595#M5673</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1371"&gt;@JoshuaBixby&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;According to the information provided by the OP, the month is used to assign January to July to Spring and August to December to Fall. Since the Month function on a date in July will be return the value 6, the expression should check for values &amp;lt; 7 to assign Spring and Fall for all other values.&lt;/P&gt;&lt;P&gt;See the sample below:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var aDate = Date(2020, 6, 22);
Console(aDate);
var datemonth = Month(aDate); 
Console(datemonth);
var maint = "Non-schedule";

if (datemonth &amp;lt; 7) {
    return maint + " Spring";
} else {
    return maint + " Fall";
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will write to the console:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;2020-07-22T00:00:00-05:00
6&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The date is in July and the month will return 6, so the value returned is "&lt;SPAN&gt;Non-schedule Spring&lt;/SPAN&gt;"&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2020 17:04:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-expression-for-date-ranges/m-p/1002595#M5673</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2020-11-18T17:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression for date ranges</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-expression-for-date-ranges/m-p/1002624#M5674</link>
      <description>&lt;P&gt;Ah, right, the JavaScript-esque of Arcade.&amp;nbsp; I have always found those languages that treat month indexing starting at 0 as odd because they don't starting day indexing at 0.&amp;nbsp; Treating months of the year differently than days of the week is silly, but I guess we can blame some smarty decades ago for starting that nonsense.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2020 18:20:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-expression-for-date-ranges/m-p/1002624#M5674</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-11-18T18:20:55Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression for date ranges</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-expression-for-date-ranges/m-p/1002650#M5675</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1371"&gt;@JoshuaBixby&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;You're not the only one that has made mistakes with this zero index month weirdness that is part of JavaScript. I have been there as well (and more than once...).&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2020 18:46:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-expression-for-date-ranges/m-p/1002650#M5675</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2020-11-18T18:46:23Z</dc:date>
    </item>
  </channel>
</rss>

