Announcement: All noncommercial projects registered to use Earth Engine before April 15, 2025 must verify noncommercial eligibility to maintain Earth Engine access.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-10-06 UTC."],[[["\u003cp\u003eThe \u003ccode\u003econtains()\u003c/code\u003e method determines if a given Date or DateRange falls entirely within another DateRange.\u003c/p\u003e\n"],["\u003cp\u003eIt returns \u003ccode\u003etrue\u003c/code\u003e if the provided Date or DateRange is fully enclosed by the target DateRange, otherwise it returns \u003ccode\u003efalse\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThis method is applicable to \u003ccode\u003eee.DateRange\u003c/code\u003e objects in Earth Engine.\u003c/p\u003e\n"],["\u003cp\u003eExamples are provided in both JavaScript and Python to illustrate the usage of \u003ccode\u003econtains()\u003c/code\u003e.\u003c/p\u003e\n"]]],["The `contains()` method checks if a given `Date` or `DateRange` falls within a specified `DateRange`. It takes an `other` object as an argument and returns a Boolean value. For example, if `dateRange1` is '2017-06-24' to '2017-07-24' and `dateRange2` is '2017-06-30' to '2017-07-10', `dateRange1.contains(dateRange2)` will return `true`. Otherwise it will return `false`. The method is used in both JavaScript and Python.\n"],null,["# ee.DateRange.contains\n\nReturns true if the given Date or DateRange is within this DateRange.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|-----------------------------|---------|\n| DateRange.contains`(other)` | Boolean |\n\n| Argument | Type | Details |\n|-------------------|-----------|---------|\n| this: `dateRange` | DateRange | |\n| `other` | Object | |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// A series of ee.DateRange objects.\nvar dateRange1 = ee.DateRange('2017-06-24', '2017-07-24');\nvar dateRange2 = ee.DateRange('2017-06-30', '2017-07-10');\nvar dateRange3 = ee.DateRange('2010-06-24', '2020-07-24');\n\n// Determine if an ee.DateRange is contained within another.\nprint('Does dateRange1 contain dateRange2?', dateRange1.contains(dateRange2));\nprint('Does dateRange1 contain dateRange3?', dateRange1.contains(dateRange3));\n```\nPython setup\n\nSee the [Python Environment](/earth-engine/guides/python_install) page for information on the Python API and using\n`geemap` for interactive development. \n\n```python\nimport ee\nimport geemap.core as geemap\n```\n\n### Colab (Python)\n\n```python\n# A series of ee.DateRange objects.\ndate_range_1 = ee.DateRange('2017-06-24', '2017-07-24')\ndate_range_2 = ee.DateRange('2017-06-30', '2017-07-10')\ndate_range_3 = ee.DateRange('2010-06-24', '2020-07-24')\n\n# Determine if an ee.DateRange is contained within another.\ndisplay(\n 'Does date_range_1 contain date_range_2?',\n date_range_1.contains(date_range_2)\n)\ndisplay(\n 'Does date_range_1 contain date_range_3?',\n date_range_1.contains(date_range_3)\n)\n```"]]