diff --git a/src/components/spatialdisplay/SpatialDisplayComponent.vue b/src/components/spatialdisplay/SpatialDisplayComponent.vue index 396b790c2..7d16bd41d 100644 --- a/src/components/spatialdisplay/SpatialDisplayComponent.vue +++ b/src/components/spatialdisplay/SpatialDisplayComponent.vue @@ -345,10 +345,9 @@ const layerHasElevation = computed(() => { watch( () => props.layerCapabilities, (layer) => { - if (layer?.keywordList !== undefined) { - forecastTime.value = - new Date(layer?.keywordList[0].forecastTime as string) ?? null - } + const _forecastTime = layer?.keywordList?.[0].forecastTime + forecastTime.value = _forecastTime ? new Date(_forecastTime) : undefined + legendLayerName.value = props.layerName legendLayerStyles.value = props.layerCapabilities?.styles if (legendLayerStyles.value === undefined && props.layerName) { diff --git a/src/components/wms/InformationPanel.vue b/src/components/wms/InformationPanel.vue index 63e6ade41..16c9f5f25 100644 --- a/src/components/wms/InformationPanel.vue +++ b/src/components/wms/InformationPanel.vue @@ -203,8 +203,12 @@ const rules = { } const analysisTime = computed(() => { - if (!props.forecastTime || isNaN(props.forecastTime.getTime())) + if (!props.forecastTime) return undefined + + if (isNaN(props.forecastTime.getTime())) { return 'Analysis time not available' + } + return ( 'Analysis time: ' + DateTime.fromJSDate(props.forecastTime).toFormat('dd/MM/yyyy, HH:mm:ss')