Esri / solution.js

TypeScript wrappers running in Node.js and modern browsers for transferring ArcGIS Online items from one organization to another.
https://esri.github.io/solution.js/
Apache License 2.0
38 stars 11 forks source link

Add support for preferredTimeReference property on Feature Services #897

Open chris-fox opened 1 year ago

chris-fox commented 1 year ago

In ArcGIS Online and Enterprise services all dates are stored in UTC. In web clients these dates are always converted to local time based on the browser timezone. In ArcGIS Pro this doesn't happen automatically, it will display in UTC by default. A new option was added to ArcGIS Online and Enterprise hosted services called preferredTimeReference that ArcGIS Pro honors when display date fields. This blog post discusses setting this option:

https://www.esri.com/arcgis-blog/products/arcgis-pro/mapping/working-with-agol-feature-services-date-time-attributes-in-non-utc-time-zone-in-arcgis-pro-2-7.

I would like to propose 2 things, we support the ability to specify this timezone at the root of the properties object of a feature service template like below. All layers in a service need to have the same preferredTimeReference and you specify it at the service level via updateDefinition and then it is pushed to all the layers in the service. If we find this property set on a layer and not null, we should pull it to the root of the properties upon creation of the template.

image

During deployment we need to apply this in an updateDefinition on the service after all the layers are added.

In addition, I would like to replace the preferredTimeReference value with a variable that we can swap out at runtime during deployment:

"preferredTimeReference": {{localTimeZone}}

This variable should be replaced with the local time zone of the browser that is deploying the solution. From the blog above the list of valid time zones comes from this Microsoft topic:

https://learn.microsoft.com/en-us/previous-versions/windows/embedded/ms912391(v=winembedded.11)

jmhauck commented 1 year ago

@chris-fox When IANA is supported we can make any updates here. This currently just looks at the offset and grabs the first name from the Microsoft list for that offset.

jmhauck commented 1 year ago

Wasn't planning to merge until after they support IANA unless you want me to.

chris-fox commented 1 year ago

No, let's leave it out until we are ready to do the full support. I removed from the 10.3 project.