TerriaJS / terriajs

A library for building rich, web-based geospatial data platforms.
https://terria.io
Apache License 2.0
1.18k stars 362 forks source link

Terria not respecting timezone returned by THREDDS WMS GetCapabilities #7143

Open sppigot opened 6 months ago

sppigot commented 6 months ago

THREDDS returns information about the time range of the data being displayed in the WMS (including the time zone - which in this case is Etc/UTC) in the GetCapabilities call:

ThreddsWMSTimeZone

Terria uses this information to populate the timeslider and the time selector for the WMS item in the workbench:

TerriaTimeBarInLocalTimeZone

Unfortunately when Terria uses this time information it changes the timezone to the local time zone of the web browser (see circled values in the image above). This is confusing for users and may lead to issues especially when these times are used in a WPS call. The issue can be worked around by changing the timezone that the browser thinks it is running in - however this is awkward and clumsy and not something that the average user can and should have to do. I think Terria should use the timezone information supplied by THREDDS for the time slider and time selectors and not attempt to convert them to the local timezone.

May have implications for https://github.com/TerriaJS/terriajs/issues/6895 - thanks @sixlighthouses !

nf-s commented 6 months ago

Hi @sppigot

I believe THREDDS (and GeoServer) will always return dates in UTC - so I don't think we can default to showing the timezone returned by those services. Generally speaking, most users want to see local timezones in Terria.

From https://github.com/TerriaJS/terriajs/discussions/6968#discussioncomment-7529300

Terria will render dates in your local timezone - this is the default behaviour for handling dates in web browsers.

If you want to display UTC times in the Terria UI - you can use the dateFormat configuration option.

For example - if you put UTC: before your format string, then the date will be shown in UTC instead of your local timezone

"dateFormat": "UTC:dd/mm/yyyy"

We were discussing this a few months ago