Skip to content

Commit

Permalink
Check for empty time configs in TimeControl
Browse files Browse the repository at this point in the history
  • Loading branch information
tariqksoliman committed Jan 2, 2024
1 parent 5e8ecf8 commit 6824701
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/essence/Ancillary/TimeControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,10 @@ var TimeControl = {

if (L_.layers.layer[layer.name] === null) return

let layerTimeFormat = d3.utcFormat(layer.time.format)
let layerTimeFormat =
layer.time?.format == null
? d3.utcFormat('%Y-%m-%dT%H:%M:%SZ')
: d3.utcFormat(layer.time.format)
layer.time.current = TimeControl.currentTime // keeps track of when layer was refreshed

let originalUrl = layer.url
Expand Down Expand Up @@ -241,7 +244,10 @@ var TimeControl = {
},
performTimeUrlReplacements: async function (url, layer) {
return new Promise(async (resolve, reject) => {
let layerTimeFormat = d3.utcFormat(layer.time.format)
let layerTimeFormat =
layer.time?.format == null
? d3.utcFormat('%Y-%m-%dT%H:%M:%SZ')
: d3.utcFormat(layer.time.format)

let nextUrl = url
if (layer.variables?.urlReplacements) {
Expand Down Expand Up @@ -344,7 +350,10 @@ var TimeControl = {
return updatedLayers
},
setLayerWmsParams: function (layer) {
var layerTimeFormat = d3.utcFormat(layer.time.format)
let layerTimeFormat =
layer.time?.format == null
? d3.utcFormat('%Y-%m-%dT%H:%M:%SZ')
: d3.utcFormat(layer.time.format)
const l = L_.layers.layer[layer.name]

if (l != null && layer.type === 'tile') {
Expand Down

0 comments on commit 6824701

Please sign in to comment.