TimeInterval
require(["esri/TimeInterval"], function(TimeInterval) { /* code goes here */ });
esri/TimeInterval
TimeInterval is a class that describes a length of time in one of ten temporal units such as seconds, days, or years. TimeInterval is referenced by many classes, such as TimeInfo, which is referenced by time-aware layers and the TimeSlider widget.
- See also:
Constructors
- new TimeInterval(properties)
- Parameter:properties Objectoptional
See the properties for a list of all the properties that may be passed into the constructor.
Property Overview
Name | Type | Summary | Class | |
---|---|---|---|---|
String | The name of the class. more details | more details | Accessor | |
String | Temporal units. more details | more details | TimeInterval | |
Number | The numerical value of the time extent. more details | more details | TimeInterval |
Property Details
The name of the class. The declared class name is formatted as
esri.folder.className
.
- unit String
Temporal units.
Possible Values:"milliseconds"|"seconds"|"minutes"|"hours"|"days"|"weeks"|"months"|"years"|"decades"|"centuries"
- Default Value:milliseconds
Example:const featureLayer = new FeatureLayer({ url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Earthquakes_Since1970/MapServer/0" }); featureLayer.load().then(function(){ const interval = featureLayer.timeInfo.interval; console.log("The layer's time interval is ", interval.value, interval.unit); });
- value Number
The numerical value of the time extent.
- Default Value:0
Example:const featureLayer = new FeatureLayer({ url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Earthquakes_Since1970/MapServer/0" }); featureLayer.load().then(function(){ const interval = featureLayer.timeInfo.interval; console.log("The layer's time interval is ", interval.value, " ", interval.unit); });
Method Overview
Name | Return Type | Summary | Class | |
---|---|---|---|---|
TimeInterval | Creates a deep clone of TimeInterval object. more details | more details | TimeInterval | |
* | 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 details | TimeInterval | |
Object | Converts an instance of this class to its ArcGIS portal JSON representation. more details | more details | TimeInterval |
Method Details
- clone(){TimeInterval}
Creates a deep clone of TimeInterval object.
Returns:Type Description TimeInterval A new instance of a TimeInfo 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 ObjectA 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:Type Description * Returns a new instance of this class.
- toJSON(){Object}
Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() guide topic for more information.
Returns:Type Description Object The ArcGIS portal JSON representation of an instance of this class.