Select to view content in your preferred language

Map Viewer - Dynamic Date Filter Based on Current Date Unit, Eg. Current Year

333
1
05-22-2025 01:23 PM
Status: Open
mwartman_grey
Regular Contributor

In Map Viewer, there is currently no option to set a date filter based on the current calendar date.

Say for example you have a live data feed of earthquake locations and want a map that shows all earthquakes from only this year. It would be nice if a filter condition existed like 'is in current date_unit' . I.e., a filter could be setup like [earthquake_date] is in current 'year', where 'year' is dynamic and changes with the system date. This way, the date filter on the webmap never has to be updated at the start of each calendar year.

Another example - say police want to show a map of car accidents that have occurred this month. They could set a filter on the web map like [accident_date] is in current 'month'. Whenever the calendar month changes, the date filter automatically updates to show accidents in the current month. On the first day of the month the map would have no features to display, but the feature count would steadily increase as the month progresses. 

These are the current date conditions available, and there is no option to filter based on current year. The 'in the last' and 'not in the last' options are close, but they don't allow filtering based on the current calendar date unit. 

mwartman_grey_0-1747943271293.png

Related: https://community.esri.com/t5/arcgis-online-questions/dynamic-date-filter-to-show-current-year-only/...

1 Comment
MoyaCalvert_01

Hi @mwartman_grey  This is not a solution but ..  you could try applying a symbology style using an arcade expression that will return a boolean True / False if your feature falls within the current year (and you only change the symbology to show the True results).  

var currentYear = Year(Now());
var YearNow = $feature.DateField >= Date(currentYear, 1, 1) && $feature.DateField <= Date(currentYear, 12, 31)
if (Boolean (YearNow)) {
  return (currentYear)
}

 

(replacing <DateField> with your date field).

Then use Types (unique symbols) symbology.
 
Assuming your layer refresh is on,, this should make the layer dynamic.