Skip To ContentArcGIS for DevelopersSign In Dashboard
require(["esri/TimeExtent"], function(TimeExtent) { /* code goes here */ });
Class: esri/TimeExtent
Inheritance: TimeExtent Accessor
Since: ArcGIS API for JavaScript 4.11

A period of time with a definitive start and end date. Time extent is used to display or query features that fall within the specified time period. To represent an instant of time, set the start and end times to the same date.

When creating a JavaScript Date, be mindful that most constructors will create a date with respect to your local timezone rather than UTC (i.e. universal time). To create a date with respect to UTC, use the UTC method on the Date object.

Example:
// Represents the data for the month of Jan, 1970
const timeExtent = new TimeExtent({
  start: new Date(Date.UTC(1970, 0, 1, 6, 30)),
  end: new Date(Date.UTC(1970, 0, 31, 6, 30))
});

Constructors

new TimeExtent(properties)
Parameter:
properties Object
optional

See the properties for a list of all the properties that may be passed into the constructor.

Example:
// Typical usage
// Represents the data for the month of Jan, 1970
const timeExtent = new TimeExtent({
  start: new Date(Date.UTC(1970, 0, 1, 6, 30)),
  end: new Date(Date.UTC(1970, 0, 31, 6, 30))
});

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
NameTypeSummaryClass
String

The name of the class.

more details
more detailsAccessor
Date

The end time of the time extent.

more details
more detailsTimeExtent
Date

The start time of the time extent.

more details
more detailsTimeExtent

Property Details

declaredClass Stringreadonly inherited

The name of the class. The declared class name is formatted as esri.folder.className.

end Date

The end time of the time extent.

Default Value:null
start Date

The start time of the time extent.

Default Value:null

Method Overview

NameReturn TypeSummaryClass
TimeExtent

Creates a deep clone of TimeExtent object.

more details
more detailsTimeExtent
*

Creates a new instance of this class and initializes it with values from a JSON object generated from a product in the ArcGIS platform.

more details
more detailsTimeExtent
TimeExtent

Returns the time extent resulting from the intersection of a given time extent and parsed time extent.

more details
more detailsTimeExtent
Object

Converts an instance of this class to its ArcGIS portal JSON representation.

more details
more detailsTimeExtent

Method Details

clone(){TimeExtent}

Creates a deep clone of TimeExtent object.

Returns:
TypeDescription
TimeExtentA new instance of a TimeExtent object equal to the object used to call .clone().
fromJSON(json){*}static

Creates a new instance of this class and initializes it with values from a JSON object generated from a product in the ArcGIS platform. The object passed into the input json parameter often comes from a response to a query operation in the REST API or a toJSON() method from another ArcGIS product. See the Using fromJSON() topic in the Guide for details and examples of when and how to use this function.

Parameter:
json Object

A JSON representation of the instance in the ArcGIS format. See the ArcGIS REST API documentation for examples of the structure of various input JSON objects.

Returns:
TypeDescription
*Returns a new instance of this class.
intersection(timeExtent){TimeExtent}
Since: ArcGIS API for JavaScript 4.12

Returns the time extent resulting from the intersection of a given time extent and parsed time extent. Returns a timeExtent with undefined values for start and end properties if the two time extents do not intersect.

Parameter:
timeExtent TimeExtent

The time extent to be intersected with the time extent on which intersection() is being called on.

Returns:
TypeDescription
TimeExtentThe intersecting time extent between two time extents.
Example:
// get the intersecting timeExtent between view.timeExtent and
// layer view filter's timeExtent
const timeExtent = view.timeExtent.intersection(layerView.effect.filter.timeExtent);
if (timeExtent){
  console.log("time intersection", timeExtent);
  const query = layerView.createQuery();
  query.timeExtent = timeExtent;
  layerView.queryFeatures(query).then(function(results){
    console.log(results.features.length, " are returned for intersecting timeExtent");
  });
}
toJSON(){Object}

Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() guide topic for more information.

Returns:
TypeDescription
ObjectThe ArcGIS portal JSON representation of an instance of this class.

API Reference search results

NameTypeModule
Loading...