This question is in regards to both using the ArcGIS Portal GUI and the ArcGIS API for Python.
I'm able to create a hosted feature service from a GeoJSON, but I'm unable to create esriFieldTypeDate fields. All date formats in the geojson properties lead to esriFieldTypeString field types. I don't have this issue when publishing from a csv.
I understand that I can delete the fields and add new ones in. But it would help our workflow to immediately declare the field type.
Here's what I do programmatically...
layer.manager.delete_from_definition({
"fields": [{"name": "created_at"}]
})layer.manager.add_to_definition({
"fields": [{
"name": "created_at",
"type": "esriFieldTypeDate",
"alias": "Created At"]
Just wondering if this is a bug when working with geojsons or if I'm not formatting my dates correctly.
I am encountering the same problem, so I appreciate the workaround you included.
That said, I agree that date fields should be typed correctly when the layer is initially published. In my case, I made sure the dates were formatted as Esri expects: https://doc.arcgis.com/en/arcgis-online/manage-data/work-with-date-fields.htm, but they were still interpreted as strings.