|
@@ -58,6 +58,10 @@ export default {
|
|
const s = new Date(Date.parse(this.activity.startTime))
|
|
const s = new Date(Date.parse(this.activity.startTime))
|
|
if (!dateIsValid(s)) { return null }
|
|
if (!dateIsValid(s)) { return null }
|
|
let intervalms = this.finishTime - s
|
|
let intervalms = this.finishTime - s
|
|
|
|
+ if (intervalms < 0) {
|
|
|
|
+ intervalms = 0
|
|
|
|
+ console.log('got time smallr')
|
|
|
|
+ }
|
|
const min = Math.floor(intervalms / 60000)
|
|
const min = Math.floor(intervalms / 60000)
|
|
const sec = (intervalms / 1000) % 60
|
|
const sec = (intervalms / 1000) % 60
|
|
|
|
|
|
@@ -66,19 +70,10 @@ export default {
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
activity (val, oldVal) {
|
|
activity (val, oldVal) {
|
|
- const finish = new Date(Date.parse(val.endTime))
|
|
|
|
|
|
+ this.finishTime = null
|
|
|
|
+ this.updateTime()
|
|
|
|
+ /* const finish = new Date(Date.parse(val.endTime))
|
|
if (dateIsValid(finish)) {
|
|
if (dateIsValid(finish)) {
|
|
- this.finishTime = null
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /* const startTime = new Date(Date.parse(val.startTime))
|
|
|
|
- const endTime = new Date(Date.parse(val.endtime))
|
|
|
|
- if (!dateIsValid(startTime) || !dateIsValid(endTime)) {
|
|
|
|
- console.log('Date is valid', dateIsValid(startTime), 'end:', dateIsValid(endTime))
|
|
|
|
- // reset timer
|
|
|
|
- this.finishTime = null
|
|
|
|
- clearTimeout(this._timeOut)
|
|
|
|
- this._timeOut = setTimeout(this.updateTime, 999)
|
|
|
|
} */
|
|
} */
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -95,7 +90,7 @@ export default {
|
|
this.finishTime = finish
|
|
this.finishTime = finish
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- this.finishTime = new Date()
|
|
|
|
|
|
+ this.finishTime = new Date(new Date().getTime() + 1000)
|
|
this._timeOut = setTimeout(this.updateTime, 999)
|
|
this._timeOut = setTimeout(this.updateTime, 999)
|
|
}
|
|
}
|
|
|
|
|