Describe the bug
QGIS only adds the TIME parameter to WMS GetMap requests on certain scales / zoom. More specifically, the TIME-parameter is not present in GetMap requests and the latest image is always displayed, unless the map is zoomed out enough.
The cutoff for this particular case seems to be a scale 1:725300, for which requests don't contain a TIME parameter at all, and scale 1:725400 for which requests correctly contain the TIME parameter and the correct result is displayed.
How to Reproduce
Add a temporal WMS layer, open the temporal controller panel. By default the latest available image is displayed correctly. Enable animated temporal navigation. QGIS properly recognizes the temporal range of the layer as defined in the capabilities document.
Drag the frame slider in temporal controller all the way back. Nothing changes, the latest image is still displayed. Curiously, the image from the selected date does appear if zooming out the map enough. Zooming back in (to any scale) results in the latest image again.
Tried clearing cache, clean profile. Tried many different and unique scale/bbox combinations. Copying the GetMap requests QGIS makes and manually appending a TIME parameter generates the correct responses from the WMS.
Image from 2020-09-15 displayed correctly, when zoomed out to a scale of ~1:1000000

Latest image (from 2020-09-25) displayed, despite keeping the frame slider in the same position, when zooming back in to ~1:500000. Zooming further in or panning the map does not fix the issue:

QGIS and OS versions
QGIS version | 3.16.3-Hannover | QGIS code branch | Release 3.16
-- | -- | -- | --
Compiled against Qt | 5.15.2 | Running against Qt | 5.15.2
Compiled against GDAL/OGR | 3.0.4 | Running against GDAL/OGR | 3.0.4
Compiled against GEOS | 3.8.1-CAPI-1.13.3 | Running against GEOS | 3.8.1-CAPI-1.13.3
Compiled against SQLite | 3.34.1 | Running against SQLite | 3.34.1
PostgreSQL Client Version | 13.1 | SpatiaLite Version | 4.3.0a
QWT Version | 6.1.6 | QScintilla2 Version | 2.11.6
Compiled against PROJ | 6.3.2 | Running against PROJ | Rel. 6.3.2, May 1st, 2020
OS Version | Arch Linux
Active python plugins | MetaSearch; db_manager; processing
Additional context
I'm using datacube-ows to provide the WMS. It has a single layer, with the following definition in GetCapabilities.xml:
<Layer queryable="1">
<Name>cloudless_mosaic</Name>
<Title>cloudless_mosaic</Title>
<Abstract>cloudless mosaic</Abstract>
<KeywordList>
...
</KeywordList>
<EX_GeographicBoundingBox>
<westBoundLongitude>26.9998170118793</westBoundLongitude>
...
</EX_GeographicBoundingBox>
<BoundingBox CRS="EPSG:3857" minx="3005605.881273969" maxx="3117432.008633051" miny="1103172.5178095326" maxy="1215721.9344109201"/>
...
<CRS>EPSG:3857</CRS>
...
<Dimension name="time" units="ISO8601">2020-09-15T14:05:00.000Z/2020-09-25T14:00:00.000Z/PT5M</Dimension>
<Style>
...
</Style>
<Attribution>
...
</Attribution>
</Layer>
The layer has images from two dates, 2020-09-15, and 2020-09-25. I moved the slider in temporal controller all the way back to 2020-09-15 14:05. Also tried moving the slider around different times on 2020-09-15 to get it to refresh.
For testing purposes, I hardcoded the value of the Dimension tag in the capabilities document to match the format I saw in another temporal WMS capabilities document that works perfectly with QGIS. The WMS provided by datacube-ows works purely on dates and completely ignores the time part of the TIME parameter in any requests, so the somewhat incorrect time values are not causing any issues.
If the TIME parameter, such as TIME=2020-09-15T15:05:00Z, is present, the WMS returns the right image. This happens when zooming out enough in QGIS, or manually making a GetMap request in a web browser. If no TIME parameter is present, the WMS returns the latest image from 2020-09-25, as it should.
I used both the server logs and the QGIS debugging/dev tools (F12 panel) to check the GetMap requests QGIS is making to the WMS. For scale 1:725300 and closer, the TIME parameter is not added. For scale 1:725400 and further away, the TIME parameter is added.
Describe the bug
QGIS only adds the TIME parameter to WMS GetMap requests on certain scales / zoom. More specifically, the TIME-parameter is not present in GetMap requests and the latest image is always displayed, unless the map is zoomed out enough.
The cutoff for this particular case seems to be a scale 1:725300, for which requests don't contain a TIME parameter at all, and scale 1:725400 for which requests correctly contain the TIME parameter and the correct result is displayed.
How to Reproduce
Add a temporal WMS layer, open the temporal controller panel. By default the latest available image is displayed correctly. Enable animated temporal navigation. QGIS properly recognizes the temporal range of the layer as defined in the capabilities document.
Drag the frame slider in temporal controller all the way back. Nothing changes, the latest image is still displayed. Curiously, the image from the selected date does appear if zooming out the map enough. Zooming back in (to any scale) results in the latest image again.
Tried clearing cache, clean profile. Tried many different and unique scale/bbox combinations. Copying the GetMap requests QGIS makes and manually appending a TIME parameter generates the correct responses from the WMS.
Image from 2020-09-15 displayed correctly, when zoomed out to a scale of ~1:1000000

Latest image (from 2020-09-25) displayed, despite keeping the frame slider in the same position, when zooming back in to ~1:500000. Zooming further in or panning the map does not fix the issue:

QGIS and OS versions
Additional context
I'm using datacube-ows to provide the WMS. It has a single layer, with the following definition in GetCapabilities.xml:
The layer has images from two dates, 2020-09-15, and 2020-09-25. I moved the slider in temporal controller all the way back to 2020-09-15 14:05. Also tried moving the slider around different times on 2020-09-15 to get it to refresh.
For testing purposes, I hardcoded the value of the Dimension tag in the capabilities document to match the format I saw in another temporal WMS capabilities document that works perfectly with QGIS. The WMS provided by datacube-ows works purely on dates and completely ignores the time part of the TIME parameter in any requests, so the somewhat incorrect time values are not causing any issues.
If the TIME parameter, such as TIME=2020-09-15T15:05:00Z, is present, the WMS returns the right image. This happens when zooming out enough in QGIS, or manually making a GetMap request in a web browser. If no TIME parameter is present, the WMS returns the latest image from 2020-09-25, as it should.
I used both the server logs and the QGIS debugging/dev tools (F12 panel) to check the GetMap requests QGIS is making to the WMS. For scale 1:725300 and closer, the TIME parameter is not added. For scale 1:725400 and further away, the TIME parameter is added.