radiantearth / stac-browser

A full-fledged UI in Vue for browsing and searching static STAC catalogs and STAC APIs
https://radiantearth.github.io/stac-browser
ISC License
284 stars 140 forks source link

Temporal filtering has issue with time zones #492

Closed LeoBreebaart closed 1 month ago

LeoBreebaart commented 1 month ago

If you browse to a collection that allows spatiotemporal item filtering, and you select a date range, and you keep hitting 'Submit' without changing anything, the list of returned items will change with each Submit.

This seems to be because of some sort of time-zone based caching effect: upon the first Submit, stac-browser correctly generates an underlying call to /items expressed in UTC, but then I then I think it keeps applying the browser's offset from UTC (which is 2 hours in my case) for each subsequent call, essentially creating a time window that's constantly moving two hours back in time...

Example: https://radiantearth.github.io/stac-browser/#/external/emc.spacebel.be/collections/EOP:ESA:Sentinel-6 Temporal Extent: 2024-10-01 ~ 2024-10-13

Underlying calls (URLs decoded/formatted for readability):

https://emc.spacebel.be/collections/EOP:ESA:Sentinel-6/items?
httpAccept=application/geo+json;profile=https://stacspec.org
&datetime=2024-10-01T00:00:00.000Z/2024-10-13T00:00:00.000Z&limit=12

https://emc.spacebel.be/collections/EOP:ESA:Sentinel-6/items?
httpAccept=application/geo+json;profile=https://stacspec.org
&datetime=2024-09-30T22:00:00.000Z/2024-10-12T22:00:00.000Z&limit=12

https://emc.spacebel.be/collections/EOP:ESA:Sentinel-6/items?
httpAccept=application/geo+json;profile=https://stacspec.org
&datetime=2024-09-30T20:00:00.000Z/2024-10-12T20:00:00.000Z&limit=12

https://emc.spacebel.be/collections/EOP:ESA:Sentinel-6/items?
httpAccept=application/geo+json;profile=https://stacspec.org
&datetime=2024-09-30T18:00:00.000Z/2024-10-12T18:00:00.000Z&limit=12

etc. etc.

Note that hitting 'Submit' without changing anything is just a minimal example. The offsetting also happens if you modify other parts of the filter dialog, e.g. if you want to switch to a different sort order on a list of retrieved results.

m-mohr commented 1 month ago

Interesting, thanks for the report. I'll have a look...

m-mohr commented 1 month ago

Should be fixed via b036d35a