<?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 How would one format the labels of a time slider to only show the &amp;quot;year&amp;quot;? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-would-one-format-the-labels-of-a-time-slider/m-p/1351807#M82847</link>
    <description>&lt;P&gt;How would one format the labels of time slider to only show the "year" from my date column? Particularly the "extent" object (see the red circles). I am able to change the "min" and "max" without much trouble using a lableFormatFunction but I cannot get the extent to change while retaining it's ability to dynamically update when adjusting the slider. Thank you!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/86647iA06426201191ACC9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
    <pubDate>Tue, 21 Nov 2023 03:25:52 GMT</pubDate>
    <dc:creator>Josh-R</dc:creator>
    <dc:date>2023-11-21T03:25:52Z</dc:date>
    <item>
      <title>How would one format the labels of a time slider to only show the "year"?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-would-one-format-the-labels-of-a-time-slider/m-p/1351807#M82847</link>
      <description>&lt;P&gt;How would one format the labels of time slider to only show the "year" from my date column? Particularly the "extent" object (see the red circles). I am able to change the "min" and "max" without much trouble using a lableFormatFunction but I cannot get the extent to change while retaining it's ability to dynamically update when adjusting the slider. Thank you!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/86647iA06426201191ACC9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 03:25:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-would-one-format-the-labels-of-a-time-slider/m-p/1351807#M82847</guid>
      <dc:creator>Josh-R</dc:creator>
      <dc:date>2023-11-21T03:25:52Z</dc:date>
    </item>
    <item>
      <title>Re: How would one format the labels of a time slider to only show the "year"?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-would-one-format-the-labels-of-a-time-slider/m-p/1351963#M82852</link>
      <description>&lt;P&gt;This labelFormatFunction returns the years in the extent (shown using this &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=widgets-timeslider-offset" target="_self"&gt;sample&lt;/A&gt;, with a few alterations)&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;labelFormatFunction: (value, type, element, layout) =&amp;gt; {
  const options = {year: 'numeric'}
  const normal = new Intl.DateTimeFormat("en-us", options);
  switch (type) {
    case "min":
      element.setAttribute("style", "color: #ff642e;");
      element.innerText = normal.format(value);
      break;
    case "max":
      element.setAttribute("style", "color: #ff642e;");
      element.innerText = normal.format(value);
      break;
    case "extent":
      const start = timeSlider.fullTimeExtent.start;
      const year0 = value[0].getFullYear();
      const year1 = value[1].getFullYear()
      element.innerText = `${year0} - ${year1}`;
      break;
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="slider.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/86708i89C23402F91D1D22/image-size/medium?v=v2&amp;amp;px=400" role="button" title="slider.png" alt="slider.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 14:31:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-would-one-format-the-labels-of-a-time-slider/m-p/1351963#M82852</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2023-11-21T14:31:30Z</dc:date>
    </item>
    <item>
      <title>Re: How would one format the labels of a time slider to only show the "year"?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-would-one-format-the-labels-of-a-time-slider/m-p/1352120#M82858</link>
      <description>&lt;P&gt;I was able to get this function to work after I reformatted my timeslider to use the same format as the provided sample.&lt;/P&gt;&lt;P&gt;For some reason I was having a hard time getting this to work within the "view.whenLayerView(layer).then((lv) =&amp;gt; {" format used in this &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=widgets-timeslider" target="_self"&gt;sample&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 17:57:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-would-one-format-the-labels-of-a-time-slider/m-p/1352120#M82858</guid>
      <dc:creator>Josh-R</dc:creator>
      <dc:date>2023-11-21T17:57:43Z</dc:date>
    </item>
  </channel>
</rss>

