Working to implement a time slider for a GeoJSONLayer using ArcGIS JS 4.21, but have run into an issue regarding the formatting of the field in the GeoJSON file.
According to https://doc.arcgis.com/en/arcgis-online/manage-data/work-with-date-fields.htm the closest supported date format for an input file is YYYY-MM-DDThh:mm:ss.s, but the GeoJSON file I am working with has the format of YYYY-MM-DDThh:mm:ss (no fractional second included).
From the timeslider filter example, it looks like the timeslider is expecting unix timestamps.
To clarify my question- how can I get the timeslider to work with GeoJSON date fields that are currently formatted as YYYY-MM-DDThh:mm:ss ?
Example code:
const layer = new GeoJSONLayer({
url: geojsonurl,
geometryType: "point",
title: "Observations",
visible: true,
fields: [
{ name: "ObservationId", type: "string" },
{ name: "MeasuredAt", type: "date" }
],
outfields: ["*"],
timeInfo: {
startField: "MeasuredAt", // name of the date field stored as "2020-06-13T09:33:00"
interval: {
unit: "days",
value: 1
}
}
Example error:
//[object, object]
{
"error":{
"code": null,
"description": "Value 2020-06-25T20:03:00 is not a valid value for the field type -
field: MeasuredAt,
type: esriFieldTypeDate,
nullable: true"
}
}
Thanks for any pointers.