Always show data timestamp in timeline bar, even with single time
This commit is contained in:
parent
4151f7d314
commit
b550f63005
1 changed files with 22 additions and 2 deletions
|
|
@ -688,16 +688,36 @@ export const PropagationMap = {
|
|||
},
|
||||
|
||||
renderTimeline() {
|
||||
if (!this.timelineEl || this.timelineData.length <= 1) {
|
||||
if (!this.timelineEl || this.timelineData.length === 0) {
|
||||
if (this.timelineEl) this.timelineEl.style.display = "none"
|
||||
return
|
||||
}
|
||||
|
||||
// Single time: show as a simple data timestamp, no buttons
|
||||
if (this.timelineData.length === 1) {
|
||||
const dt = new Date(this.timelineData[0].time)
|
||||
const utcLabel = `${dt.getUTCHours().toString().padStart(2, "0")}:00 UTC`
|
||||
const dateLabel = `${dt.getUTCFullYear()}-${(dt.getUTCMonth() + 1).toString().padStart(2, "0")}-${dt.getUTCDate().toString().padStart(2, "0")}`
|
||||
this.timelineEl.style.display = "block"
|
||||
this.timelineEl.innerHTML = `
|
||||
<div style="background:rgba(0,0,0,0.85);border-radius:12px;padding:6px 14px;display:flex;gap:8px;align-items:center;box-shadow:0 2px 12px rgba(0,0,0,0.4);font-size:11px;color:rgba(255,255,255,0.6);">
|
||||
<span>Data: ${dateLabel} ${utcLabel}</span>
|
||||
</div>`
|
||||
return
|
||||
}
|
||||
|
||||
// Hide timeline if all times are within 1 hour (no real forecast spread)
|
||||
const firstDt = new Date(this.timelineData[0].time)
|
||||
const lastDt = new Date(this.timelineData[this.timelineData.length - 1].time)
|
||||
if (lastDt - firstDt < 3600000) {
|
||||
this.timelineEl.style.display = "none"
|
||||
const dt = firstDt
|
||||
const utcLabel = `${dt.getUTCHours().toString().padStart(2, "0")}:00 UTC`
|
||||
const dateLabel = `${dt.getUTCFullYear()}-${(dt.getUTCMonth() + 1).toString().padStart(2, "0")}-${dt.getUTCDate().toString().padStart(2, "0")}`
|
||||
this.timelineEl.style.display = "block"
|
||||
this.timelineEl.innerHTML = `
|
||||
<div style="background:rgba(0,0,0,0.85);border-radius:12px;padding:6px 14px;display:flex;gap:8px;align-items:center;box-shadow:0 2px 12px rgba(0,0,0,0.4);font-size:11px;color:rgba(255,255,255,0.6);">
|
||||
<span>Data: ${dateLabel} ${utcLabel}</span>
|
||||
</div>`
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue