Application Framework Reference

Splunk API

containsTime()

The containsTime() method checks if the specified dateObj time is contained in the current time range.

Note: This method is only accurate for absolute terms contained in the current time range. If relative or real-time terms are used, the method always returns true .

Synopsis

contains = containsTime( dateObj )

Parameters

dateObj

Object

Time, of type JavaScript Date() object.

Return Value

Boolean

Time included indication:

True = Specified dateObj is included in current time range, or there are relative or real-time terms in the current time range object.

False = Specified dateObj is not included in current time range.

Example

var context = this.getContext();var search = context.get('search');
var range = search.getTimeRange();
var new_time = new Date();
if (range.isAbsolute() && range.containsTime(new_time)) {
    alert('this will fire only if range is absolute and contains new_time');
}
 

See Also

containsRange()
equalToRange()
isAbsolute()
isRealTime()
isRelative()