timeUtils

AMD: require(["esri/support/timeUtils"], (timeUtils) => { /* code goes here */ });
ESM: import * as timeUtils from "@arcgis/core/support/timeUtils.js";
Object: esri/support/timeUtils
Since: ArcGIS Maps SDK for JavaScript 4.21

Provides utility methods for working with dates.

Method Overview

Name Return Type Summary Object
Promise<TimeExtent>

Returns the time extent of all layers.

more details
timeUtils

Method Details

getTimeExtentFromLayers(layers, signal){Promise<TimeExtent>}

Returns the time extent of all layers.

Parameters

An array or collection of layers to compute a time extent from.

signal AbortSignal
optional

AbortSignal allows for cancelable requests. If canceled, the promise will be rejected with an error named AbortError. See also AbortController.

Returns
Type Description
Promise<TimeExtent> Returns a promise that resolves to a TimeExtent.
Examples
// Get the time extent of all layers in the view.
const fullTimeExtent = await getTimeExtentFromLayers(view.map.allLayers);
// Get the time extent from an array of layers.
const timeExtent = await getTimeExtentFromLayers([
  earthquakes,
  emergencyCalls
]);

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.