I have web service that is showing road closures that usually last less than a day. I am trying to find a way to only show the closures on the map that are active, so after the start date/time and before the end date/time. I have been trying to accomplish this by using an arcade symbology expression, but I can't figure out. Says the expression is right but doesn't show the closures I want on the map.
Is this the best way to accomplish this? Does anybody have an idea on how to best set up the expression? I have 3 types of date time fields to choose from, I can't figure out any of them out. I have attached an image of the field options I have.
Here is one expression I tried with the epoch date fields.
//ToLocal(Timestamp())
var started = $feature.closureStartEpoch
var closed = $feature.closureEndEpoch
var present = date()
// if current date/time is greater than or equal to the start time
// AND current date/time is less than or equal to the close time
// return open, otherwise its closed
If (present >= started && present <= closed) {
return "Open"
If (present <= started && present >= closed) {
return "Closed"
}
} else {
return "Other"
}
These are the Start and End Date/Time fields I have to choose from.