A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developers.arcgis.com/javascript/latest/api-reference/esri-TimeExtent.html below:

TimeExtent | API Reference | ArcGIS Maps SDK for JavaScript 4.33

ESM: import TimeExtent from "@arcgis/core/TimeExtent.js";

CDN: const TimeExtent = await $arcgis.import("@arcgis/core/TimeExtent.js");

Class: @arcgis/core/TimeExtent

Since: ArcGIS Maps SDK for JavaScript 4.11

Deprecated since version 4.31. Use TimeExtent instead.

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
TimeExtent Constructor new TimeExtent(properties)

Parameter

optional

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

Example

// Create a new time extent for the period starting Jan 1st 1970 and ending Jan 31st 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 Watch for changes topic.

Show inherited properties Hide inherited properties

Property Details
declaredClass

Inherited

Property declaredClass Stringreadonly

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

The end time of the time extent.

The start time of the time extent.

Method Overview

Show inherited methods Hide inherited methods

Name Return Type Summary Class addHandles()

Adds one or more handles which are to be tied to the lifecycle of the object.

Accessor clone() TimeExtent

Creates a deep clone of TimeExtent object.

TimeExtent expandTo() TimeExtent

Expands the TimeExtent so that the start and end dates are rounded down and up, respectively, to the parsed time unit.

TimeExtent fromJSON() *|null|undefined

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

TimeExtent hasHandles() Boolean

Returns true if a named group of handles exist.

Accessor intersection() TimeExtent

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

TimeExtent removeHandles()

Removes a group of handles owned by the object.

Accessor toJSON() Object

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

TimeExtent union() TimeExtent

Returns the time extent resulting from the union of the current time extent and a given time extent.

TimeExtent Method Details
addHandles

Inherited

Method addHandles(handleOrHandles, groupKey)

Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, addHandles added at 4.25.

Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.

// Manually manage handles
const handle = reactiveUtils.when(
  () => !view.updating,
  () => {
    wkidSelect.disabled = false;
  },
  { once: true }
);

this.addHandles(handle);

// Destroy the object
this.destroy();

Parameters

Handles marked for removal once the object is destroyed.

groupKey *

optional

Key identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.

Creates a deep clone of TimeExtent object.

Returns

Type Description TimeExtent A new instance of a TimeExtent object equal to the object used to call .clone().
expandTo Method expandTo(unit, timeZone){TimeExtent}

Since: ArcGIS Maps SDK for JavaScript 4.18 TimeExtent since 4.18, expandTo added at 4.18.

Expands the TimeExtent so that the start and end dates are rounded down and up, respectively, to the parsed time unit.

Parameters

The time unit to align the start and end dates.

Possible Values:"milliseconds"|"seconds"|"minutes"|"hours"|"days"|"weeks"|"months"|"years"|"decades"|"centuries"

The time zone in which progressing will occur. The default is "system".

Possible Values:"system"|"unknown"

Returns

Type Description TimeExtent A new expanded TimeExtent.

Examples

// Expand a time extent to a decade.
const extent = new TimeExtent({
  start: new Date(2012, 3, 5),
  end: new Date(2019, 0, 4)
});
const decade = extent.expandTo("decades");
// decade is: 1/1/2010 to 1/1/2020
// Expand a time extent to the nearest month.
const extent = new TimeExtent({
  start: new Date(2012, 3, 5),
  end: new Date(2019, 0, 4)
});
const expandToMonth = extent.expandTo("months");
// expandToMonth is: 4/1/2012 to 2/1/2019

Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product. 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.

Returns

Type Description * | null | undefined Returns a new instance of this class.
hasHandles

Inherited

Method hasHandles(groupKey){Boolean}

Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, hasHandles added at 4.25.

Returns true if a named group of handles exist.

Parameter

groupKey *

optional

A group key.

Returns

Type Description Boolean Returns true if a named group of handles exist.

Example

// Remove a named group of handles if they exist.
if (obj.hasHandles("watch-view-updates")) {
  obj.removeHandles("watch-view-updates");
}
intersection Method intersection(timeExtent){TimeExtent}

Since: ArcGIS Maps SDK for JavaScript 4.12 TimeExtent since 4.18, intersection added at 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

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

Returns

Type Description TimeExtent The 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");
  });
}
removeHandles

Inherited

Method removeHandles(groupKey)

Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, removeHandles added at 4.25.

Removes a group of handles owned by the object.

Parameter

groupKey *

optional

A group key or an array or collection of group keys to remove.

Example

obj.removeHandles(); // removes handles from default group

obj.removeHandles("handle-group");
obj.removeHandles("other-handle-group");

Since: ArcGIS Maps SDK for JavaScript 4.18 TimeExtent since 4.18, union added at 4.18.

Returns the time extent resulting from the union of the current time extent and a given time extent.

Parameter

The time extent to be unioned with.

Returns

Type Description TimeExtent The resulting union of the current time extent and the given time extent.

Example

// Return the union of two time extents. One from 1990 to 2000 and the second from 2010 to 2020.
const decade1 = new TimeExtent({
  start: new Date(1990, 0, 1),
  end: new Date(2000, 0, 1)
});
const decade2 = new TimeExtent({
  start: new Date(2010, 0, 1),
  end: new Date(2020, 0, 1)
});
const union = decade1.union(decade2);
console.log(`The unioned extent starts from year ${union.start.getFullYear()} to ${union.end.getFullYear()}`);
// output: "The unioned extent starts from year 1990 to 2020"

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4