AnsweredAssumed Answered

Featurelayer DefinitionExpression based on Date Range

Question asked by evtguy on Aug 31, 2015
Latest reply on Sep 2, 2015 by evtguy

I have a layer of construction closures in an app I'm developing and for each closure, there is a field for the starting date of the closure (startDate) and a field for the ending date of the closure (endDate). Ideally, I'd like to add a definitionExpression to the FeatureLayer to automatically handle the visibility of any current closures.


I know I can't just use:


var curDate = new Date();

var fLayer = new FeatureLayer("url", {
    definitionExpression:  "endDate <= Date " + curDate;
    mode: FeatureLayer.MODE_ONDEMAND


because that would show current projects but also older, expired projects. So how would I structure the definition expression?