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 .
contains = containsTime( dateObj )
|
dateObj |
Object |
Time, of type JavaScript Date() object. |
|
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. |
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');
}