Skip to content

Commit

Permalink
Merge pull request #927 from Deltares/926-only-include-analysis-time-…
Browse files Browse the repository at this point in the history
…when-forecasttime-is-available-in-getcapabilities

Hide analysis time when not present in GetCapabilities
  • Loading branch information
ceesvoesenek authored Jun 18, 2024
2 parents e5dd7da + 07b5a9b commit 03dcf34
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/components/spatialdisplay/SpatialDisplayComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 5 additions & 1 deletion src/components/wms/InformationPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 03dcf34

Please sign in to comment.