ee.DateRange.contains

Returns true if the given Date or DateRange is within this DateRange.

UsageReturns
DateRange.contains(other)Boolean
ArgumentTypeDetails
this: dateRangeDateRange
otherObject

Examples

Code Editor (JavaScript)

// A series of ee.DateRange objects.
var dateRange1 = ee.DateRange('2017-06-24', '2017-07-24');
var dateRange2 = ee.DateRange('2017-06-30', '2017-07-10');
var dateRange3 = ee.DateRange('2010-06-24', '2020-07-24');

// Determine if an ee.DateRange is contained within another.
print('Does dateRange1 contain dateRange2?', dateRange1.contains(dateRange2));
print('Does dateRange1 contain dateRange3?', dateRange1.contains(dateRange3));

Python setup

See the Python Environment page for information on the Python API and using geemap for interactive development.

import ee
import geemap.core as geemap

Colab (Python)

# A series of ee.DateRange objects.
date_range_1 = ee.DateRange('2017-06-24', '2017-07-24')
date_range_2 = ee.DateRange('2017-06-30', '2017-07-10')
date_range_3 = ee.DateRange('2010-06-24', '2020-07-24')

# Determine if an ee.DateRange is contained within another.
display(
    'Does date_range_1 contain date_range_2?',
    date_range_1.contains(date_range_2)
)
display(
    'Does date_range_1 contain date_range_3?',
    date_range_1.contains(date_range_3)
)