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

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 Object
optional

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

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
String

Temporal units.

more details
more detailsTimeInterval
Number

The numerical value of the time extent.

more details
more detailsTimeInterval

Property Details

declaredClass Stringreadonly inherited

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

NameReturn TypeSummaryClass
TimeInterval

Creates a deep clone of TimeInterval object.

more details
more detailsTimeInterval
*

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 detailsTimeInterval
Object

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

more details
more detailsTimeInterval

Method Details

clone(){TimeInterval}

Creates a deep clone of TimeInterval object.

Returns:
TypeDescription
TimeIntervalA 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 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.
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...