wrong diffusion

This commit is contained in:
bkfox
2022-05-21 17:07:16 +02:00
parent 094e0ef1d2
commit 59d5a1c3dc
2 changed files with 7 additions and 2 deletions

View File

@ -30,9 +30,14 @@ export default class Live {
response.ok ? response.json()
: Promise.reject(response)
).then(data => {
data.forEach(item => {
if(item.start) item.start = new Date(item.start)
if(item.end) item.end = new Date(item.end)
})
this.items = data
let item = this.items && this.items[this.items.length-1]
const now = new Date()
const item = data.find(it => it.start && (it.start <= now < it.end))
if(item) {
item.src = this.src
this.current = new Model(item)