import FieldsIndex from "@arcgis/core/layers/support/FieldsIndex.js";
            const FieldsIndex = await $arcgis.import("@arcgis/core/layers/support/FieldsIndex.js");
            @arcgis/core/layers/support/FieldsIndex
        This class provides convenient methods that can be used to make case-insensitive lookups for a field by its name. It also provides more information such as the list of date fields in a layer.
Constructors
- 
  
  
  
  
  
  
  
  
    Parameterproperties ObjectoptionalSee the properties for a list of all the properties that may be passed into the constructor. 
Property Overview
Property Details
- 
  
    An array of date fields or field json objects. - Default Value:[]
 
Method Overview
| Name | Return Type | Summary | Class | 
|---|---|---|---|
| Returns a field with the specified field name. | FieldsIndex | ||
| Returns a time zone for a field. | FieldsIndex | ||
| Checks if a field with the specified field name exists in the layer. | FieldsIndex | ||
| Checks if a field with the specified field name is a date field. | FieldsIndex | 
Method Details
- 
  
  
    Returns a field with the specified field name. Returns
- 
  
  
    Returns a time zone for a field. Use this method to ensure queries in the following places are issued in the time zone of the given datefield:The following table explains the value returned from this method: Field type Returned value Date field Returns the time zone associated with the date field. Returns unknownif the layer's date fields are in unknown time zone.Date-only, Time-only or Timestamp-offset field Returns unknownas services do not have time zone associated withdate-only,time-onlyandtimestamp-offsetfields. Date-only and time-only fields are time zone agnostic. Timestamp-offset field values store its time offset.All other fields Returns null.ReturnsExample// Query for features that recorded on January 1, 2012 9:00:00 AM GMT // DateTime_PST date field values are in PST. Must adjust the epoch values to PST const queryDate = new Date(1325408400000); 01/01/2012 9:00:00 AM GMT let queryFields = ["DateTime_PST"]; // get the timezone of the DateTime_PST date field const fieldTimeZone = layer.fieldsIndex.getTimeZone("DateTime_PST") ; // we need to adjust the date value to match the time zone of the field. const where = `DateTime_PST < DATE '${getDateForTimeZone(queryDate, fieldTimeZone)}'` layerView.filter = new FeatureFilter({ where }); runQueries(where, queryFields); // This function conveniently formats a date in terms of the parsed time zone. function getDateForTimeZone(queryDate, timezone) { // adjust the given date field to the timezone of the date field const zonedDate = new Date( queryDate.toLocaleString("en-US", { timeZone: timezone }) ); const pad = (value) => String(value).padStart(2, "0"); const month = pad(zonedDate.getMonth() + 1); const day = pad(zonedDate.getDate()) const year = zonedDate.getFullYear(); const hour = pad(zonedDate.getHours()); const minutes = pad(zonedDate.getMinutes()); const seconds = pad(zonedDate.getSeconds()); return `${year}-${month}-${day} ${hour}:${minutes}:${seconds}`; }